NPM not found
The bug description
Unknown cause:
- Maybe he used one
n stable
, upgrade node; - It could also be used
npm i -g npm
To upgrade the NPM; - It is also possible that the MAC has quietly upgraded the system.
In short, the results spiralled out of control: NPM not found
try
Curve 1:
Change. ZSHRC PATH, Google out of the solution, did not understand, did not solve the problem.
Curve 2:
Because the error contained ZSH, we took a detour, deleted ZSH, changed the shell environment, and still reported an error. Because that’s not the reason. ZSHRC: uninstall_oh_my_zsh: uninstall_oh_my_zsh: uninstall_oh_my_zsh: uninstall_oh_my_zsh: uninstall_oh_my_zsh:
cat /etc/shells/bin/sh
chsh -s /bin/bash
ZSH is still present in the error, because terminal was not closed and restarted.- Restart terminal. Goose, these are not the problem, so the problem remains. Without ZSH, still
Enable the NVM
Difference between NVM and N
One more thing, why NVM:
NVM is an external shell script independent of Node/NPM, so the n command is more limited than the NVM command. Solution:
- NVM is installed remotely
The curl - o - https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
2) Install the old version of NodeNVM install v8.9
3) which node
Before installing NVM:
4) Cut to your old version
NVM use v8.9
test
harvest
node
As the operating environment of the whole project, it is also dependent on NPM. There is a matching relationship between the versions of the two, and neither of them can be arbitrarily modified, especiallynpm
; (????? If this is indeed the cause of the problem, it is a gain; So this is not necessarily true)nvm
As anode
Management or becausen
Yes, I’ll use it laternvm
!- Macos upgrades should also be careful: because
/usr/local
can no longer be chown’d in High Sierra.
Instead usesudo chown -R $(whoami) $(brew --prefix)/*
Afterword.
Module build failed: Error: Missing binding… node_modules/node-sass/vendor/darwin-x64-57/binding.node
NPM Rebuild node-sass The project is running… 😔
Second, the NPM ERR! Unexpected end of JSON input while parsing near ‘… Ace – event “:” ^ 1.0.0, “” ‘
The bug description
At this point, NPM I keeps reporting errors and error logs cannot find valid information. NPM package path error:
To solve
Tried to find the NPM package path, but no root problem was found;
solve
Run NPM cache clean –force. NPM I has no previous error. Explore what NPM caching is all about.
npm cache
Reference (NPM cache) [docs.npmjs.com/cli/cache]
End~
Welcome to put forward the cause analysis and solution of similar bug. Thank you!
Refenrence:
- nvm in github
- detail compare
- Select the shell with CHSH