【已解决】github上拉去代码执行 npm install报错 code:128 和 Error: EPERM: operation not permitted

背景

npm ERR! code 128
npm ERR! Command failed: git clone --depth=1 -q -b fix/ie-cannot-input-korean git://github.com/sohee-lee7/Squire.git C:\Users\Chocolate\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-b32fd8a4 --config core.longpaths=true   
npm ERR! warning: templates not found in C:\Users\CHOCOL~1\AppData\Local\Temp\pacote-git-template-tmp\git-clone-1254515c
npm ERR! fatal: read error: Invalid argument
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Chocolate\AppData\Roaming\npm-cache\_logs\2020-07-20T02_36_57_452Z-debug.log

解决办法

执行如下命令:

git config --global http.sslverify "false"

再执行 npm install 就可以了

如果上述命令执行完后,还是报那个错误,请继续执行如下命令,亲测有效

git config --global url."https://".insteadOf git://

另一个bug

Error: EPERM: operation not permitted

这个 bug 真是困扰我多年呐,今天终于解决了。主要报错是自己打开 vscode,每次执行 npm install 都会说没权限,后面按照如下方式解决了:

删除C:\Users\用户名\.npmrc 文件

学如逆水行舟,不进则退

猜你喜欢

转载自blog.csdn.net/weixin_42429718/article/details/107458549