Updating npm: Cannot find module 'y18n' npm ERR? - node.js

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

Related

cannot find module 'readable-stream/transform'

I'm trying to use to npm to install anything, and nothing works. I get the error code 'MODULE_NOT_FOUND' and 'cannot find module 'readable-stream/transform''.
I've tried uninstall and reinstalling nodejs. In the process I lost nodemon and now I can't even reinstall it because of this error.
This is the log of the error from Appdata/Roaming/npm-cache/_logs
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'i' ]
2 info using npm#6.9.0
3 info using node#v10.16.0
4 verbose stack Error: Cannot find module 'readable-stream/transform'
4 verbose stack at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
4 verbose stack at Function.Module._load (internal/modules/cjs/loader.js:562:25)
4 verbose stack at Module.require (internal/modules/cjs/loader.js:690:17)
4 verbose stack at require (internal/modules/cjs/helpers.js:25:18)
4 verbose stack at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\mississippi\node_modules\through2\through2.js:1:17)
4 verbose stack at Module._compile (internal/modules/cjs/loader.js:776:30)
4 verbose stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
4 verbose stack at Module.load (internal/modules/cjs/loader.js:653:32)
4 verbose stack at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
4 verbose stack at Function.Module._load (internal/modules/cjs/loader.js:585:3)
4 verbose stack at Module.require (internal/modules/cjs/loader.js:690:17)
4 verbose stack at require (internal/modules/cjs/helpers.js:25:18)
4 verbose stack at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\mississippi\index.js:5:26)
4 verbose stack at Module._compile (internal/modules/cjs/loader.js:776:30)
4 verbose stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
4 verbose stack at Module.load (internal/modules/cjs/loader.js:653:32)
5 verbose cwd C:\Users\adamn\Desktop\Development\adamNode
6 verbose Windows_NT 10.0.17134
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
8 verbose node v10.16.0
9 verbose npm v6.9.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'readable-stream/transform'
12 verbose exit [ 1, true ]
npm install should install different modules but I just get errors instead.
I had the same problem, but it solved by taking long hours of googling.
The problem is a package named mississippi is outdated and cause the problem!
From you error log:
4 verbose stack at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\mississippi\node_modules\through2\through2.js:1:17)
Where you can some useful things about it: github#1809
Just remove the 'C:\Program Files\nodejs\node_modules\npm\node_modules' folder, unInstall the nodejs and npm and reinstall them again!
Additional information for Arch Linux users, that modules are not located under '/opt/local/lib/node_modules' as other distributions or installation mechanism, And so remove and installation of the nodejs and npm will not solve the problem!
sudo rm -rf /usr/lib/node_modules
sudo pacman -S nodejs npm

Unable to install/ uninstall anything using npm

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.

angular cli not able to install, getting error as `Cannot find module 'hosted-git-info' `

I am trying to create new project using ng new but getting error as :
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'hosted-git-info'
here is the detailed 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\\MB112830\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '--quiet' ]
2 info using npm#5.7.1
3 info using node#v8.9.4
4 verbose stack Error: Cannot find module 'hosted-git-info'
4 verbose stack at Function.Module._resolveFilename (module.js:538:15)
4 verbose stack at Function.Module._load (module.js:468:25)
4 verbose stack at Module.require (module.js:587:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\MB112830\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:3:21)
4 verbose stack at Module._compile (module.js:643:30)
4 verbose stack at Object.Module._extensions..js (module.js:654:10)
4 verbose stack at Module.load (module.js:556:32)
4 verbose stack at tryModuleLoad (module.js:499:12)
4 verbose stack at Function.Module._load (module.js:491:3)
5 verbose cwd E:\Tutorials\Angular2\NG5\new-way
6 verbose Windows_NT 10.0.10240
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\MB112830\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
8 verbose node v8.9.4
9 verbose npm v5.7.1
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'hosted-git-info'
12 verbose exit [ 1, true ]
what is the issue here? how to solve this?
It is because the files are corrupted or deleted.So follows the below steps.
1.Uninstall node.
2.Delete npm and npm-cache folder from C:\Users\userName\AppData\Roaming
3.Install node.
It works!.
Hi as i can see your project in E: drive please try to install angular in C drive globally.
npm install -g #angular/cli
after installation please create a project folder name(client) by
c://>ng new client
after creation of new project go inside client folder
C:// > cd client
c:// > client>ng serve
Open browser with localhost:4200 you can see your angular home page in running mode.
:)Cheers

npm: "Cannot find module internal/errors"

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.

sudo npm install -g react-native ERR!Cannot find module './spawn'

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 ;)

Resources