We are getting the following error while adding mosca = require("mosca") to my server.js script., any pointers here will be helpful. ^
Error: Cannot find module 'mosca/index.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/lib/openshift/537dd88d5973ca6907000057/app-root/runtime/repo/server.js:8:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'
You need to install the package first:
npm install mosca
Better yet, install it and add it to your package.json:
npm install --save mosca
This is resolved now, Some how mosca module is not being installing, so I have installed locally and copied content to node_modules
Related
I'm adding 1 new library to my project (express-fileupload), but, when run node server this return that message, I tried with the commands:
npm install
npm loader
npm install winston (this for a problem reported in a Github project)
npm start
but this dont work.
$ node server.js
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module '/lib/index'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\david\Documents\INTRANET\dusoft-server\server.js:15:18)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
I am getting the following error upon runing bower install.
$ bower install
module.js:340
throw err;
^
Error: Cannot find module 'minimist'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/home/ubuntu/.nvm/versions/node/v5.1.0/lib/node_modules/bower/node_modules/bower-config/node_modules/optimist/index.js:2:16)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
I have "minimist" installed as a local npm package but not globally. Is there any way to get bower to recognize the local package and avoid installing minimist globally?
Running npm install -S minimist in a CLI from your project root directory should solve your problem.
I have updated my node to latest one.
I have also tried uninstalled and reinstalled the node one time to fix this problem but no success.
I have also run the command sudo npm install -g to-fast-properties to install this module.
Can anyone help why this error is still coming?
browserify -t babelify app.js -o bundle.js
module.js:338
throw err;
^
Error: Cannot find module 'to-fast-properties'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/saurabhchaudhary/www/react-soundplayer/examples/node_modules/babelify/node_modules/babel-core/lib/types/index.js:23:25)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
By the I am using react library which I would like to browserify my js code to execute in browser. Is there any other way to do same?
My code was working previously before, but seems to have stopped working. I tried yo angular:route api but this error was returned:
Error: Cannot find module 'ansi-styles'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-angular/node_modules/chalk/index.js:2:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I have added all the dependencies required to my package file, update npm (which is now on 2.0.0alpha), all npm packages, and ran npm install. The site still works when I grunt serve.
(The O.P.):
I found the reason I got the error. I had to change the npm root folder and reinstalled my packages in the default folder and now it works.
Just needed to run npm install here. Was a fresh clone out of Git.
Installing the module globally working for me.
npm install ansi-styles -g
When trying to use gulp, I'm having ' Cannot find module 'node-sass-middleware' ' error.
module.js:340
throw err;
^
Error: Cannot find module 'node-sass-middleware'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/wallet/node_modules/gulp-sass/node_modules/node-sass/sass.js:180:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
node-sass-middleware is empty for some reason.
I've installed gulp like
sudo npm install -g gulp
node-sass-middleware folder has appeared, but its empty inside but a node_modules folder which is also empty.
/home/wallet/node_modules/gulp-sass/node_modules/node-sass/node_modules/node-sass-middleware/.js
Am I installing gulp wrong?