无法安装npm作用域包

时间:2018-10-10 09:05:13

标签: npm npm-install

我的项目使用私有注册表包和通用包。 我根据https://docs.npmjs.com/misc/scope上的文档设置了范围注册表 这是配置列表输出:

C:\Users\anam\Desktop\login_page>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\anam\.npmrc
@infromatica:registry = "http://infamvn:8081/nexus/content/groups/npmJs_GRP/"
email = "anam@informatica.com"
registry = "https://registry.npmjs.org/"

; builtin config undefined
prefix = "C:\\Users\\anam\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\anam\Desktop\login_page
; HOME = C:\Users\anam
; "npm config ls -l" to show all defaults.

当我尝试安装有作用域的软件包时,我得到:

C:\Users\anam\Desktop\login_page>npm i @informatica/archipelago-icons
npm ERR! code E404
npm ERR! 404 Not Found: @informatica/archipelago-icons@0.0.2

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\anam\AppData\Roaming\npm-cache\_logs\2018-10-10T08_57_43_329Z-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   '@informatica/archipelago-icons' ]
2 info using npm@6.4.1
3 info using node@v8.12.0
4 verbose npm-session 758a10490a81bd2d
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 404 https://registry.npmjs.org/@informatica%2farchipelago-icons 3339ms
8 silly fetchPackageMetaData error for @informatica/archipelago-icons@0.0.2 404 Not Found: @informatica/archipelago-icons@0.0.2
9 timing stage:rollbackFailedOptional Completed in 0ms
10 timing stage:runTopLevelLifecycles Completed in 3589ms
11 verbose stack Error: 404 Not Found: @informatica/archipelago-icons@0.0.2
11 verbose stack     at fetch.then.res (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
11 verbose stack     at tryCatcher (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
11 verbose stack     at Promise._settlePromiseFromHandler (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
11 verbose stack     at Promise._settlePromise (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
11 verbose stack     at Promise._settlePromise0 (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
11 verbose stack     at Promise._settlePromises (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
11 verbose stack     at Async._drainQueue (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
11 verbose stack     at Async._drainQueues (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
11 verbose stack     at Immediate.Async.drainQueues (C:\Users\anam\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
11 verbose stack     at runCallback (timers.js:810:20)
11 verbose stack     at tryOnImmediate (timers.js:768:5)
11 verbose stack     at processImmediate [as _immediateCallback] (timers.js:745:5)
12 verbose cwd C:\Users\anam\Desktop\login_page
13 verbose Windows_NT 10.0.16299
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "@informatica/archipelago-icons"
15 verbose node v8.12.0
16 verbose npm  v6.4.1
17 error code E404
18 error 404 Not Found: @informatica/archipelago-icons@0.0.2
19 verbose exit [ 1, true ]

请注意第7行:

7 http fetch GET 404 https://registry.npmjs.org/@informatica%2farchipelago-icons 

似乎在默认注册表中而不是在范围内查找软件包。

感谢您的帮助。 谢谢。

1 个答案:

答案 0 :(得分:0)

原来,错误的原因是错误的范围命名: @in 来回 matica:registry =“ http://infamvn:8081/nexus/content/groups/npmJs_GRP/