简体   繁体   中英

Node Js Error Module.js 549

While starting my application, I get this error. I have already checked and seen that the required module is well installed, and also gave it global access.

Hussains-MacBook-Pro:NodeRest-Shop Hussain$ npm start

> noderest-shop@1.0.0 start /Users/Hussain/Desktop/Development/Web/NodeRest-Shop
> nodemon server.js

module.js:549
    throw err;
    ^

Error: Cannot find module 'binary-extensions'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/Hussain/Desktop/Development/Web/NodeRest-Shop/node_modules/is-binary-path/inde
x.js:3:24)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! noderest-shop@1.0.0 start: `nodemon server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the noderest-shop@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Hussain/.npm/_logs/2018-06-25T05_23_59_594Z-debug.log

You're missing the binary-extensions module, as seen in your log:

Error: Cannot find module 'binary-extensions'

It could be that you're missing some dependencies or forgot to include it.

You can install it using :

 npm install binary-extensions

And include binaryExtensions in your project:

const binaryExtensions = require('binary-extensions');

我通过运行解决了这个问题:

npm i npm@latest -g

Check your app.js file your index route should be app.use(require('./routes/')); not app.use(require('./routes/index'));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM