npm ERR! code ENOLOCAL


Microsoft Windows [版本 6.1.7601]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。

G:\vue>cnpm i vue-router -S
'cnpm' 不是內部或外部命令,也不是可運行的程序
或批處理文件。

G:\vue>npm install -g cnpm –registry=https://registry.npm.taobao.org
npm ERR! code ENOLOCAL
npm ERR! Could not install from "–registry=https:\registry.npm.taobao.org" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Users\realm\AppData\Roaming\npm-cache\_logs\2019-12-08T13_37_40_758Z-debug.log

G:\vue>node -v
v12.13.1

G:\vue>npm install -g install
+ install@0.13.0
updated 1 package in 1.087s

G:\vue>
G:\vue>
G:\vue>rm -r -f node_modules
'rm' 不是內部或外部命令,也不是可運行的程序
或批處理文件。

G:\vue>cpm install
'cpm' 不是內部或外部命令,也不是可運行的程序
或批處理文件。

G:\vue>cnpm install
'cnpm' 不是內部或外部命令,也不是可運行的程序
或批處理文件。

G:\vue>npm install -g cnpm –registry=https://registry.npm.taobao.org
npm ERR! code ENOLOCAL
npm ERR! Could not install from "–registry=https:\registry.npm.taobao.org" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Users\realm\AppData\Roaming\npm-cache\_logs\2019-12-08T13_40_45_806Z-debug.log

G:\vue>npm install -g node-gyp
D:\Users\realm\AppData\Roaming\npm\node-gyp -> D:\Users\realm\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js
+ node-gyp@6.0.1
added 3 packages from 2 contributors and updated 9 packages in 32.358s

G:\vue>cnpm install
'cnpm' 不是內部或外部命令,也不是可運行的程序
或批處理文件。

G:\vue>npm install -g cnpm –registry=https://registry.npm.taobao.org
npm ERR! code ENOLOCAL
npm ERR! Could not install from "–registry=https:\registry.npm.taobao.org" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Users\realm\AppData\Roaming\npm-cache\_logs\2019-12-08T13_44_18_594Z-debug.log

G:\vue>npm cache verify
Cache verified and compressed (~\AppData\Roaming\npm-cache\_cacache):
Content verified: 267 (6461740 bytes)
Content garbage-collected: 21 (380630 bytes)
Index entries: 405
Finished in 1.516s

G:\vue>npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer
, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Users\realm\AppData\Roaming\npm-cache\_logs\2019-12-08T13_48_53_767Z-debug.log

G:\vue>npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.

G:\vue>npm install -g cnpm –registry=https://registry.npm.taobao.org
npm ERR! code ENOLOCAL
npm ERR! Could not install from "–registry=https:\registry.npm.taobao.org" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Users\realm\AppData\Roaming\npm-cache\_logs\2019-12-08T13_49_35_280Z-debug.log

G:\vue>npm i -g npm
D:\Users\realm\AppData\Roaming\npm\npx -> D:\Users\realm\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
D:\Users\realm\AppData\Roaming\npm\npm -> D:\Users\realm\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
+ npm@6.13.2
added 430 packages from 854 contributors in 61.607s

G:\vue>npm install -g cnpm --registry=http://registry.npm.taobao.org
D:\Users\realm\AppData\Roaming\npm\cnpm -> D:\Users\realm\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm
+ cnpm@6.1.0
added 680 packages from 938 contributors in 65.011s

G:\vue>

 

npm升級后,npm install 報錯了,這就尷尬了。
Google了一下在這里(https://github.com/npm/npm/issues/16861)找到了解決方案:
里面各種解決方案,讓Try這個命令Try那個命令,看着一臉懵逼不知道該用那個命令,瀏覽評論的時候發現“npm cache verify”這條命令幫助了不少人,然后果斷在iterm2執行了,嗯,莫名其妙的好了。

評論里的命令有下面這些:

npm cache verify
npm cache clean
npm cache clean --force
npm i -g npm
grep -ir "sha1-xxxxxxxxxxxxxxxx" ~/.npm

實在不行就一條一條執行試試,看那個能幫到你


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM