On a MacBook with the latest version of NodeJS, I am trying to update npm:
npm install npm#latest
The error message is:
npm ERR: code MODULE_NOT_FOUND
npm ERR: Cannot find module 'internal/errors'
npm ERR: A complete log of this run can be found in:
npm ERR: /Users/alexander/.npm/_logs/2017_09_15_12_35_47_079Z-debug.log
and the referenced log file reads
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'npm#latest' ]
2 info using npm#5.3.0
3 info using node#v8.5.0
4 verbose npm-session 5db7f116200ca64c
5 verbose stack Error: Cannot find module 'internal/errors'
5 verbose stack at Function.Module._resolveFilename (module.js:527:15)
5 verbose stack at Function.Module._load (module.js:476:23)
5 verbose stack at Module.require (module.js:568:17)
5 verbose stack at require (internal/module.js:11:18)
5 verbose stack at evalmachine.<anonymous>:36:16
5 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1)
5 verbose stack at Module._compile (module.js:624:30)
5 verbose stack at Object.Module._extensions..js (module.js:635:10)
5 verbose stack at Module.load (module.js:545:32)
5 verbose stack at tryModuleLoad (module.js:508:12)
5 verbose stack at Function.Module._load (module.js:500:3)
5 verbose stack at Module.require (module.js:568:17)
5 verbose stack at require (internal/module.js:11:18)
5 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/graceful-fs.js:3:27)
5 verbose stack at Module._compile (module.js:624:30)
5 verbose stack at Object.Module._extensions..js (module.js:635:10)
6 verbose cwd /Users/alexander/Documents/Source/Repos
7 verbose Darwin 16.7.0
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "npm#latest"
9 verbose node v8.5.0
10 verbose npm v5.3.0
11 error code MODULE_NOT_FOUND
12 error Cannot find module 'internal/errors'
13 verbose exit [ 1, true ]
The same worked ok on the windows machine.
What is the problem and how can I fix this?
Try to reinstall npm from the package in node v6.11.3LTS, and then
try to update to the latest npm v5.4.2
npm install npm#latest -g
and then update to the latest node v8.3.0
npm install node#latest -g
I had the same issue, the above answer did not work.
I had old versions in node_modules.
I simply deleted everything in node_modules and then ran:
npm install npm#latest -g
I had the same problem, and I solve it:
uninstall node and npm, do as this answer.
then install node
brew install node
and npm will also be installed.
Related
I'm working through a tutorial about learning npm, but am having trouble with even the simplest instructions.
Basically the first instruction given was to install the node-dev package globally, using the Terminal line: sudo npm install -g node-dev. Unfortunately, this spits out an error:
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './access-error.js'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/samlegros/.npm/_logs/2019-02-26T00_36_39_572Z-debug.log
After some Googling and digging, nothing seemed to work for my case. So I thought I would try fully removing and reinstalling npm to start with a clean slate (I had worked with npm a while back, so maybe something messed up back then).
Even going through the official npm-removal documentation, I still get a similar error! I can't even remove npm properly...
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './access-error.js'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/samlegros/.npm/_logs/2019-02-26T00_38_40_865Z-debug.log
Any help would be deeply appreciated. I've tried several npm tutorials over the months and they always result in errors that I just never know how to overcome, very discouraging :(
(error log, if that helps)
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'uninstall',
1 verbose cli 'npm',
1 verbose cli '-g' ]
2 info using npm#6.8.0
3 info using node#v8.11.1
4 verbose stack Error: Cannot find module './access-error.js'
4 verbose stack at Function.Module._resolveFilename (module.js:547:15)
4 verbose stack at Function.Module._load (module.js:474:25)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/install/exists.js:4:19)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
4 verbose stack at tryModuleLoad (module.js:505:12)
4 verbose stack at Function.Module._load (module.js:497:3)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/install/check-permissions.js:8:14)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
5 verbose cwd /path/to/tutorial/
6 verbose Darwin 18.2.0
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "uninstall" "npm" "-g"
8 verbose node v8.11.1
9 verbose npm v6.8.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module './access-error.js'
12 verbose exit [ 1, true ]
I simply removed Node.js from my Mac and reinstalled it, that worked.
Command used to remove Node.js: sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
Everything works great now.
This error occurred while command npm run watch was in process, I tried to solve it with different tactics but can't find any solution
Steps which I tried to resolve the issue
1) Remove node module, package-lock.json, yarn.lock npm cache clear and the run npm install but error still occurs.
2) Remove nodejs from control panel and reinstall with latest and then old/previous version and the reinstall but can't succeed, error still occurs.
npm ERR! code MODULE_NOT_FOUND npm ERR! Cannot find module
'spdx-expression-parse'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\DELL\AppData\Roaming\npm-cache_logs\2018-12-20T08_00_01_749Z-debug.log
Log File
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#6.5.0
3 info using node#v8.12.0
4 verbose stack Error: Cannot find module 'spdx-expression-parse'
4 verbose stack at Function.Module._resolveFilename (module.js:548:15)
4 verbose stack at Function.Module._load (module.js:475:25)
4 verbose stack at Module.require (module.js:597:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\DELL\AppData\Roaming\npm\node_modules\npm\node_modules\validate-npm-package-license\index.js:1:75)
4 verbose stack at Module._compile (module.js:653:30)
4 verbose stack at Object.Module._extensions..js (module.js:664:10)
4 verbose stack at Module.load (module.js:566:32)
4 verbose stack at tryModuleLoad (module.js:506:12)
4 verbose stack at Function.Module._load (module.js:498:3)
5 verbose cwd D:\it-88-lynx
6 verbose Windows_NT 10.0.17134
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
8 verbose node v8.12.0
9 verbose npm v6.5.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'spdx-expression-parse'
12 verbose exit [ 1, true ]
Atlast, I have solved the problem, the spdx-expression-parse has been corrupted located in users/AppData/Roaming/npm/node_modules/
remove node_modules
uninstall nodejs
(Start Main Step)
Go to users/AppData/Roaming and delete npm and npm-cache folders manually
(End Main Step)
then run following command
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
thanks for all your suppport.
I did not update npm for a while. My version is 5.8.0
the current is 6.4.1
I tried this command, but did not work:
$ npm install npm#latest -g
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'y18n'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\erjan222\AppData\Roaming\npm-cache\_logs\2018-09-16T14_16_55_797Z-debug.log
Googling for similar topic on npm forum did not help -
y18-n
The debug.log file has this:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\erjan222\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'npm#latest',
1 verbose cli '-g' ]
2 info using npm#5.8.0
3 info using node#v8.10.0
4 verbose stack Error: Cannot find module 'y18n'
4 verbose stack at Function.Module._resolveFilename (module.js:547:15)
4 verbose stack at Function.Module._load (module.js:474:25)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\erjan222\AppData\Roaming\npm\node_modules\npm\node_modules\cacache\lib\util\y.js:4:14)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
4 verbose stack at tryModuleLoad (module.js:505:12)
4 verbose stack at Function.Module._load (module.js:497:3)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\erjan222\AppData\Roaming\npm\node_modules\npm\node_modules\cacache\lib\entry-index.js:13:11)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
5 verbose cwd C:\Users\erjan222\Desktop
6 verbose Windows_NT 6.1.7601
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\erjan222\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "npm#latest" "-g"
8 verbose node v8.10.0
9 verbose npm v5.8.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'y18n'
12 verbose exit [ 1, true ]
I recommend that you try install y18n first then upgrade npm like this:
npm install y18n#4.0.0 -g
npm install npm#latest -g
Or install 8.12.0 LTS from nodejs
First, upgrade your npm to latest version and Then install y18n module using this commands
npm i -g npm-upgrade
npm i y18n
If you want to ignore particular module from npm update,refer this link answer.
npm install: Is there a way to ignore a particular dependency
In Windows, I tried to create a new application form of this site: https://facebook.github.io/react/docs/installation.html
First, I installed Node.js v8.2.1 and when I execute npm install -g create-react-app, I get the following error:
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'json-parse-helpfulerror'
npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\mushou8\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'create-react-app' ]
2 info using npm#5.2.0
3 info using node#v6.11.2
4 verbose stack Error: Cannot find module 'json-parse-helpfulerror'
4 verbose stack at Function.Module._resolveFilename (module.js:469:15)
4 verbose stack at Function.Module._load (module.js:417:25)
4 verbose stack at Module.require (module.js:497:17)
4 verbose stack at require (internal/module.js:20:19)
4 verbose stack at Object.<anonymous> (C:\Users\mushou8\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:12:16)
4 verbose stack at Module._compile (module.js:570:32)
4 verbose stack at Object.Module._extensions..js (module.js:579:10)
4 verbose stack at Module.load (module.js:487:32)
4 verbose stack at tryModuleLoad (module.js:446:12)
4 verbose stack at Function.Module._load (module.js:438:3)
5 verbose cwd C:\Users\mushou8
6 verbose Windows_NT 6.1.7601
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mushou8\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "create-react-app"
8 verbose node v6.11.2
9 verbose npm v5.2.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'json-parse-helpfulerror'
12 verbose exit [ 1, true ]
In the directory folder, issue the following command:
npm update
Remove npm and reinstall it
And run:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
Seeing what is requested in the Users folder, it seems that it should be installed as a global package.
Check and install each required package.
npm i -g json-parse-helpfulerror
You must uninstall nodejs and npm packages.
after first, you must install npm.
and you should install "npm install --save json-parse-better-errors"
Finally you can run your project
https://www.npmjs.com/package/json-parse-better-errors
I fixed it by removing the node_modules folder and reinstalling it again. To remove the folder, go to your project folder and run $ rm -rf node_modules and then reinstall your packages using your preferred package manager, either npm i or yarn install.
npm error when I try to build the React Native environment with Mac.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'react-native' ]
2 info using npm#2.15.9
3 info using node#v4.6.0
4 verbose stack Error: Cannot find module './spawn'
4 verbose stack at Function.Module._resolveFilename (module.js:325:15)
4 verbose stack at Function.Module._load (module.js:276:25)
4 verbose stack at Module.require (module.js:353:17)
4 verbose stack at require (internal/module.js:12:17)
4 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:6:13)
4 verbose stack at Module._compile (module.js:409:26)
4 verbose stack at Object.Module._extensions..js (module.js:416:10)
4 verbose stack at Module.load (module.js:343:32)
4 verbose stack at Function.Module._load (module.js:300:12)
4 verbose stack at Module.require (module.js:353:17)
4 verbose stack at require (internal/module.js:12:17)
5 verbose cwd /Users/BigGIfts
6 error Darwin 15.6.0
7 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "react-native"
8 error node v4.6.0
9 error npm v2.15.9
10 error code MODULE_NOT_FOUND
11 error Cannot find module './spawn'
12 error If you need help, you may report this error at:
12 error <https://github.com/npm/npm/issues>
13 verbose exit [ 1, true ]
The correct way to build the react-native:
npm install -g react-native-cli
If you get an error like:
Cannot find module 'npmlog'
Try installing npm directly: curl -0 -L https://npmjs.org/install.sh | sudo sh
Note: when the error cannot find ... is anywhere in the error log and you did install it, it's probably either in the wrong directory or you haven't installed it yet.
Hope this helps you out ;)