node.js - 无法在某个范围内安装 NPM 包,或者无法在范围内安装 NPM 包(或者看起来像这样)

标签 node.js npm

从今天早上开始,我发现我无法再从某个范围安装任何 NPM 包(或任何具有依赖项的包)。例如,如果我输入 npm i webpack 我会收到以下错误...

npm ERR! code E401 npm ERR! 401 Unauthorized: @webassemblyjs/wasm-parser@1.7.11

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\tempo_000\AppData\Roaming\npm-cache_logs\2018-11-28T11_54_44_456Z-debug.log

日志有以下有趣的部分...

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',
1 verbose cli   'webpack' ]
2 info using npm@6.4.1
3 info using node@v8.12.0
4 verbose npm-session bda7db37888d1d27
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/webpack 16ms (from cache)
8 silly pacote range manifest for webpack@^4.11.1 fetched in 42ms
9 timing stage:loadCurrentTree Completed in 1037ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 4ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 332ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule webpack@4.26.1 checking installable status
17 http fetch GET 200 https://registry.npmjs.org/@webassemblyjs%2fast 45ms (from cache)
18 http fetch GET 200 https://registry.npmjs.org/acorn 46ms (from cache)
19 http fetch GET 200 https://registry.npmjs.org/acorn-dynamic-import 47ms (from cache)
20 http fetch GET 200 https://registry.npmjs.org/chrome-trace-event 49ms (from cache)
21 http fetch GET 200 https://registry.npmjs.org/ajv-keywords 49ms (from cache)
22 http fetch GET 200 https://registry.npmjs.org/ajv 49ms (from cache)
23 http fetch GET 200 https://registry.npmjs.org/enhanced-resolve 52ms (from cache)
24 silly pacote version manifest for @webassemblyjs/ast@1.7.11 fetched in 60ms
25 silly resolveWithNewModule @webassemblyjs/ast@1.7.11 checking installable status
26 silly pacote range manifest for acorn@^5.6.2 fetched in 60ms
27 silly resolveWithNewModule acorn@5.7.3 checking installable status
28 silly pacote range manifest for acorn-dynamic-import@^3.0.0 fetched in 62ms
29 silly resolveWithNewModule acorn-dynamic-import@3.0.0 checking installable status
30 silly pacote range manifest for chrome-trace-event@^1.0.0 fetched in 63ms
31 silly resolveWithNewModule chrome-trace-event@1.0.0 checking installable status
32 silly pacote range manifest for ajv-keywords@^3.1.0 fetched in 64ms
33 silly resolveWithNewModule ajv-keywords@3.2.0 checking installable status
34 silly pacote range manifest for ajv@^6.1.0 fetched in 65ms
35 silly resolveWithNewModule ajv@6.5.5 checking installable status
36 silly pacote range manifest for enhanced-resolve@^4.1.0 fetched in 66ms
37 silly resolveWithNewModule enhanced-resolve@4.1.0 checking installable status
38 http fetch GET 200 https://registry.npmjs.org/eslint-scope 18ms (from cache)
39 http fetch GET 200 https://registry.npmjs.org/json-parse-better-errors 18ms (from cache)
40 http fetch GET 200 https://registry.npmjs.org/loader-runner 17ms (from cache)
41 http fetch GET 200 https://registry.npmjs.org/memory-fs 17ms (from cache)
42 http fetch GET 200 https://registry.npmjs.org/loader-utils 17ms (from cache)
43 http fetch GET 200 https://registry.npmjs.org/micromatch 18ms (from cache)
44 http fetch GET 200 https://registry.npmjs.org/neo-async 17ms (from cache)
45 silly pacote range manifest for eslint-scope@^4.0.0 fetched in 27ms
46 silly resolveWithNewModule eslint-scope@4.0.0 checking installable status
47 silly pacote range manifest for json-parse-better-errors@^1.0.2 fetched in 33ms
48 silly resolveWithNewModule json-parse-better-errors@1.0.2 checking installable status
49 silly pacote range manifest for loader-runner@^2.3.0 fetched in 34ms
50 silly resolveWithNewModule loader-runner@2.3.1 checking installable status
51 silly pacote range manifest for memory-fs@~0.4.1 fetched in 34ms
52 silly resolveWithNewModule memory-fs@0.4.1 checking installable status
53 silly pacote range manifest for loader-utils@^1.1.0 fetched in 38ms
54 silly resolveWithNewModule loader-utils@1.1.0 checking installable status
55 silly pacote range manifest for micromatch@^3.1.8 fetched in 39ms
56 silly resolveWithNewModule micromatch@3.1.10 checking installable status
57 silly pacote range manifest for neo-async@^2.5.0 fetched in 39ms
58 silly resolveWithNewModule neo-async@2.6.0 checking installable status
59 http fetch GET 200 https://registry.npmjs.org/node-libs-browser 31ms (from cache)
60 http fetch GET 200 https://registry.npmjs.org/schema-utils 27ms (from cache)
61 http fetch GET 200 https://registry.npmjs.org/tapable 21ms (from cache)
62 http fetch GET 200 https://registry.npmjs.org/terser-webpack-plugin 22ms (from cache)
63 http fetch GET 200 https://registry.npmjs.org/webpack-sources 21ms (from cache)
64 http fetch GET 200 https://registry.npmjs.org/watchpack 21ms (from cache)
65 silly pacote range manifest for node-libs-browser@^2.0.0 fetched in 36ms
66 silly resolveWithNewModule node-libs-browser@2.1.0 checking installable status
67 silly pacote range manifest for tapable@^1.1.0 fetched in 26ms
68 silly resolveWithNewModule tapable@1.1.1 checking installable status
69 silly pacote range manifest for terser-webpack-plugin@^1.1.0 fetched in 28ms
70 silly resolveWithNewModule terser-webpack-plugin@1.1.0 checking installable status
71 silly pacote range manifest for schema-utils@^0.4.4 fetched in 36ms
72 silly resolveWithNewModule schema-utils@0.4.7 checking installable status
73 silly pacote range manifest for webpack-sources@^1.3.0 fetched in 30ms
74 silly resolveWithNewModule webpack-sources@1.3.0 checking installable status
75 silly pacote range manifest for watchpack@^1.5.0 fetched in 31ms
76 silly resolveWithNewModule watchpack@1.6.0 checking installable status
77 http fetch GET 401 https://registry.npmjs.org/@webassemblyjs%2fwasm-parser 147ms
78 silly fetchPackageMetaData error for @webassemblyjs/wasm-parser@1.7.11 401 Unauthorized: @webassemblyjs/wasm-parser@1.7.11
79 http fetch GET 401 https://registry.npmjs.org/@webassemblyjs%2fhelper-module-context 156ms
80 silly fetchPackageMetaData error for @webassemblyjs/helper-module-context@1.7.11 401 Unauthorized: @webassemblyjs/helper-module-context@1.7.11
81 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fwasm-edit 465ms (from cache)
82 silly pacote version manifest for @webassemblyjs/wasm-edit@1.7.11 fetched in 471ms
83 silly resolveWithNewModule @webassemblyjs/wasm-edit@1.7.11 checking installable status
84 timing stage:rollbackFailedOptional Completed in 1ms
85 timing stage:runTopLevelLifecycles Completed in 1867ms

如果我运行npm config list来检查注册表,则不存在本地或非标准配置...

; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.4.1 node/v8.12.0 win32 x64"

; userconfig C:\Users\tempo_000\.npmrc
email = "keith@ministryotech.co.uk"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Development\Training\Base Stacks\vanilla-scss
; HOME = C:\Users\tempo_000
; "npm config ls -l" to show all defaults.

昨天工作正常,我已经测试过,但它不适用于 3 个不同的项目。

我安装了 nvm,并在 Node 8.12 和 10.11 下尝试了相同的操作,并得到了相同的结果。

最佳答案

这看起来像是 NPM 中的一个错误 - 刚刚记录

https://npm.community/t/can-t-install-scoped-packages-e401-unauthorized/3631/10

关于node.js - 无法在某个范围内安装 NPM 包,或者无法在范围内安装 NPM 包(或者看起来像这样),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53519042/

相关文章:

node.js - 如何在使用 yarn 安装 npm 依赖项时忽略不兼容的引擎 "node"错误?

node.js - node.js 新手发现可能的 PATH 变量错误

javascript - 当我写入文件时如何正确捕获错误?

javascript - 如何将 ajax 调用中的函数从 JQuery 传递到 Node.JS 服务器

windows - 使用VLC的虚拟界面时如何防止显示控制台

node.js - 如何更改谷歌计算中的权限以便 Node 可以写入文件?

symfony - npm run build 语法错误 : unexpected token '?' Symfony 5. 4.19

javascript - `npm build` 没有在 package.json 中构建 't run the script named "

node.js - 使用 NPM 安装最高 semver 主要版本 X

css - 如何在react-table中添加淡入淡出效果?