bower install not recognizing local npm package? - javascript

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.

Related

uglify Error: Cannot find module 'optimist'

I am going to uglify index.js file. But it throws this error: Cannot find module 'optimist'.
I have installed optimist: npm install optimist but it doesn't work. Anyone can help?
uglifyjs index.js
module.js:550
throw err;
^
Error: Cannot find module 'optimist'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/nodejs/uglify-js/bin/uglifyjs:8:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
try this command,
npm i optimist --save
If It does not work then try this,
Delete node_modules folder & package-lock.json
&then try this command,
npm i --save

Node server.js not responding and thows error message

I am starts working on expressJs nodeJs but stuck at a beginning point to run the node server.js command. I think any module is missing to install but i`m not recognize which one is missing.Im working on linux(ubuntu) operating system. Please help me to out this problem.
iron#iron-System-Product-Name:/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master$ node server.js
module.js:442
throw err;
^
Error: Cannot find module '/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master/config/env/undefined'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master/config/routes.js:6:14)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master/server.js:14:13)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
Node Version: v6.2.2
Npm version: 3.9.5
it take undefined of variable which may you declare in config/env/undefined.
Please check your env file or if possible share with me .
Thanks
With the error, i suspect you are missing iron-node module.
To simply install in project, run
npm i iron-node
to install and save it in the project's package.json, run:
npm i iron-node --save
to install it in your computer, do:
npm i -g iron-node
However, since this is a development dependency, you should install it as one and save it in package.json, by:
npm i iron-node -D --save

npm --> Err: Cannot find module 'readable-stream'

I have installed node js on my windows 10 machine, and the version is v4.4.2 but when I try to run npm install or even check npm version it throwing the following error. Any help would be greatly appreciated
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Also, after reading other solutions to this problem, npm install gulp -g, npm install 'readable-stream' or any other suggestion I read and tried did not work. It appears any command I try with npm throws the error below.
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
I have also tried uninstalling node and reinstalling and same issue persists.
I figured it out, when I uninstalld I did not delete all the files. There were the node/npm files in my C: directory and failed to realize there were a bunch of npm module files in my / directory. So after uninstalling and deleting all related files I reinstalled node/npm and it is now working.
After all the checks its clear you need to uninstall and re-install node:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable // for stable version
sudo n 0.12.7 // for specific version like v0.12.7
// check the node version after install
node -v
If you are on windows make sure after you Uninstall node you %appdata% or C:\Users\admin\AppData\Roaming and delete all the npm folders that have been created here by your previous install.
git clone https://github.com/nodejs/readable-stream into global node_modules folder

Module Not Found Node Js 'to-fast-properties'

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?

Error: Cannot find module 'ansi-styles' in AngularJS with Yeoman generator

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

Categories