Installing error when trying to npm install - node.js

I'm new to node.js, and I've been trying to npm install some modules - namely, cheerio, express and request. But I keep getting this:
npm WARN package.json node-web-scrape#0.0.1 No repository field.
npm WARN package.json node-web-scrape#0.0.1 No README data
npm WARN package.json node-web-scrape#0.0.1 No license field.
npm WARN retry will retry, error on last attempt: Error: EBUSY: resource busy or locked, rename 'C:\Users\user\AppData\Local\Temp\npm-16500-38020820\registry.npmjs.org\jsdom\-\jsdom-7.2.2.tgz.1538180439' -> 'C:\Users\user\AppData\Local\Temp\npm-16500-38020820\registry.npmjs.org\jsdom\-\jsdom-7.2.2.tgz'
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "cheerio"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
But the folder node_modules still appears in my directory. So OK, I try stuff on it. My main.js file has the following:
var request = require('request');
console.log("Hello, World!")
That's all it's got. Immediately, it breaks:
C:\Users\user\Documents\Crawler>node main
module.js:327
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\user\Documents\Crawler\node_modules\request\node_modules\bl\node_modules\readable-stream\lib\_stream_duplex.js:21:23)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
Help?

Since you're using npm version 2.15.8, windows has a limit of folder depth. Update your npm to npm#3.
npm install -g npm#3
npm cache clear
Then, delete your node_modules/ before installing the npm modules(cheerio, express, request)
Source: BountySource

Related

NPM showing error message after adding the Prop-Types in react project

This is the error message after I finished installation of Prop-Types Validation in my create-react-app
> burgerapp#0.1.0 start C:\Users\ajeet\Desktop\burgerapp
> node scripts/start.js
module.js:540
throw err;
^
Error: Cannot find module 'webpack'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\ajeet\Desktop\burgerapp\scripts\start.js:19:17)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! burgerapp#0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the burgerapp#0.1.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! C:\Users\ajeet\AppData\Roaming\npm-cache\_logs\2018-02-04T23_43_08_160Z-debug.log
Please help me to find solution. Thank you for your help.
this just sometimes happens with npm when adding packages, especially with create-react-app projects. Delete node_modules and run npm install again, that should fix it.
You can install webpack by using command 'npm install webpack --dev'.

Cannot find module 'has-flag'

Getting below error while "npm run build" on server.On local machine working fine. Getting 500 response on server
node version:8.0
npm version: 5.0.3
Error: Cannot find module 'has-flag'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous>
(/usr/share/../../../node_modules/postcss/node_modules/supports-color/index.js:2:15)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ***#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ***#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Try npm install --save has-flag. It looks like supports-color is requiring has-flag to be installed but it isn't. If you need to install any other packages you can just type npm install.
The above didn't work for me, but deleting my node_modules and dist folders and rerunning npm install did.

How can I make this npm project works?

I'm trying to make working a tool that I found on Github and I'm not able to get in touch with the creator of this.
I've this output:
const express = require('express'),
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
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)
at startup (node.js:119:16)
at node.js:906:3
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "D:\\Program Files (x86)\\nodejs\\0.10.29\\node.exe" "D:\\Program Files (x86)\\npm\\3.9.5\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.10.29
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! PROJECT-NAME#0.0.0 start: `node ./app.js`
npm ERR! Exit status 8
How can I do (I'm using windows)?
Thank you so much!
To enable some of the ECMAScript 2015 features (including const) in Node.js 0.10 start your node program with a harmony flag, otherwise you will get a syntax error. For example:
node --harmony app.js

NPM: cannot find module './lib' after upgrading to Node.js 5.0 on OS X

Background
I just upgraded from Node.js v4.1.1 to v5.0.0 on my Mac. I used the node-v5.0.0.pkg installer from the node website because I don't have nvm or n installed, and I didn't install through Homebrew or MacPorts).
Problem
Now, every time I run npm I get the following error in my terminal:
Error: Cannot find module './lib'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/hawk/index.js:1:80)
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:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './lib'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
I can't even re-install NPM through the traditional method of running npm install -g npm because the package manager itself doesn't work.
How do I get NPM working again on my Mac?
Solution:
rm -rf /usr/local/lib/node_modules/npm
Reinstall node js v5.0.0
Other notes:
Looks like other people are running in to the same problem (see issue #3606). It sounds like a fix is in the works, so this issue will probably be resolved in the next release. In the interim, the only solution is to completely purge npm from your system and reinstall.

npm install i18next-conv: Error: Cannot find module 'readable-stream'

I'm trying to install i18next-conv but, when I run sudo npm install i18next-conv -g, I get this error:
Error: Cannot find module 'readable-stream'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/sha/index.js:3:48)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
If you need help, you may report this log at:
<http://github.com/isaacs/npm/issues>
or email it to:
<npm-#googlegroups.com>
System Darwin 11.4.2
command "node" "/usr/local/bin/npm" "install" "i18next-conv" "-g"
cwd /Users/personalcomputer/Desktop
node -v v0.6.18
npm -v 1.3.5
Additional logging details can be found in:
/Users/personalcomputer/Desktop/npm-debug.log
not ok code undefined
not ok code 1
Can anyone tell me what can I do to install it?
Thanks!
I think this should be solved if you update node.js and possibly npm as well.
Note you can update npm with npm itself via the command:
sudo npm install -g npm
What I had to do was update node version from node web page

Resources