typpo / textbelt

Free API for outgoing SMS
https://textbelt.com/
MIT License
3.05k stars 515 forks source link

Error: Cannot find module 'express' #141

Closed Grunticus03 closed 5 years ago

Grunticus03 commented 5 years ago

When executing nodejs /server/app.js, I get the following error:

module.js:328
    throw err;
    ^

Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/etc/textbelt/server/app.js:1:79)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
Grunticus03 commented 5 years ago

Ok, so I unzipped this repo to /etc/textbelt then executed npm install which then installed all the dependencies. When I run nodejs ./server/app.js I get the following error:

/etc/textbelt/server/app.js:51
  let { message } = req.body;
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

So I nano app.js and change the curly braces to parenthesis and run nodejs ./server/app.js again. This time, I get the following error:

/etc/textbelt/lib/text.js:6
let config = require('./config.js');
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/etc/textbelt/server/app.js:5:14)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
typpo commented 5 years ago

Hello, late reply but it looks like you're using an old version of node without ES6 support.