B
B
berch2018-11-23 17:40:19
Node.js
berch, 2018-11-23 17:40:19

How to solve TypeError: xls is not a function at Object.?

Using classic example for excel package
App.js file:

var xls = require('excel')
xls('Sheet.xlsx', function(err, data) { 
  if(err) throw err
  // data is an array of arrays 
})

I get an error
/mnt/c/Projects/www.m-y.ru__2/app.js:17
[0] xls('Sheet.xlsx', function(err, data) {
[0] ^
[0]
[0] TypeError: xls is not a function
[0]     at Object.<anonymous> (/mnt/c/Projects/www.m-y.ru__2/app.js:17:1)
[0]     at Module._compile (module.js:652:30)
[0]     at Object.Module._extensions..js (module.js:663:10)
[0]     at Module.load (module.js:565:32)
[0]     at tryModuleLoad (module.js:505:12)
[0]     at Function.Module._load (module.js:497:3)
[0]     at Module.require (module.js:596:17)
[0]     at require (internal/module.js:11:18)
[0]     at Object.<anonymous> (/mnt/c/Projects/www.m-y.ru__2/index.js:1:75)
[0]     at Module._compile (module.js:652:30)
[0]     at Object.Module._extensions..js (module.js:663:10)
[0]     at Module.load (module.js:565:32)
[0]     at tryModuleLoad (module.js:505:12)
[0]     at Function.Module._load (module.js:497:3)
[0]     at Function.Module.runMain (module.js:693:10)
[0]     at startup (bootstrap_node.js:191:16)
[0]     at bootstrap_node.js:612:3

Please tell me what is the problem?
node -v
v8.11.4

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question