Problem background: Node and NPM have been installed on the original MAC computer, but in the process of a misoperation, it was found that the nPM-V command could not be typed out, prompting the Command not Found. Tamping many times, finally decisive after all kinds of search uninstall clean and then reinstall all.
Problems:
1 node-v can have a version prompt, npm-v does not have a version prompt, and the output NPM command not found
2 brew install node can have a version prompt, brew install NPM prompt error.
Solutions:
(1) Delete old files: delete them according to the prompts, or delete them directly (operation can be carried out in access)
sudo npm uninstall npm -g
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
Confirm whether to uninstall:
node -v
npm -v
(2) Reinstall Node
brew install node
(3) Associate node with the soft link
brew link node
At this time, we may have the following results:
Linking /usr/local/Cellar/node/11.2.0...
Error: Could not symlink include/node/common.gypi
Target /usr/local/include/node/common.gypi
already exists. You may want to remove it:
rm '/usr/local/include/node/common.gypi'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
localhost:wkdir meng$ brew link --overwrite node
Linking /usr/local/Cellar/node/11.2.0...
Error: Could not symlink include/node/common.gypi
/usr/local/include/node is not writable.
(4) Then we will enforce it according to the prompts:
brew link --overwrite --dry-run node
Enforcement may require us to delete some of the previous files related to Node, as shown below
Would remove:
/usr/local/include/node/common.gypi
/usr/local/include/node/config.gypi
/usr/local/include/node/libplatform/libplatform-export.h
/usr/local/include/node/libplatform/libplatform.h
/usr/local/include/node/libplatform/v8-tracing.h
(5) Continue to delete the above file and run it again
brew link --overwrite node
Install the NPM
sudo npm install --registry=https://registry.npm.taobao.org
Check node and NPM again
node -v
npm -v
Results:
Note: There may be a variety of problems. When there is a problem, try baidu, and then go on to solve the next problem.
For more personal tutorials, please visit the personal homepage:
Github builds personal blog (2019 update, pro test)
.https://blog.csdn.net/xudailong_blog/article/details/78762262
The public no. :
Read More:
- Installation and unloading of Python module
- NPM can’t find D: //nodejs/node all of The solution of sudden_modules/NPM/bin/npm-cli.js
- Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘
- Completely uninstall node and NPM on MAC
- [Solved] gitbook: node_modules\npm\node_modules\graceful-fs\polyfills.js:287
- Error: No such keg: /usr/local/Cellar/node&install nvm&brew installation&Oh my zsh.git installation&git set alias&No bundle URL prese
- NPM and Node.js Version incompatibility
- NPM installs dependent packages and reports an error node gyp rebuild… Solution
- NPM ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
- Solution of node canvas error reporting in MacOS M1 installation
- brew install node Error: No such file or directory @ dir_chdir Bottle installation failed
- Solution to node sass installation failure
- Vue init webpack command error Vue cli / node_ modules/_ [email protected]@rimraf/rimraf.js :313
- Idea installation vue.js After plug-in, new has no Vue component
- Copy node causes NPM execution error: cannot find module ‘/ / lib / utils/ unsupported.js ‘
- NPM and cnpm installation failure solution
- Simple solution for node sass installation failure
- Node configuration environment variable and global installation of webapck
- The solution to reload and rollback of VMware after unloading
- Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’ npm ERR! at Error (native)