我将使用Nexus 3作为npm私有仓库。我有一个需要一些依赖项的项目,例如:
如果我执行以下npm install命令,一切正常:
我该怎样解决这个问题?
@nodelib/fs.stat
,@mrmlnc/readdir-enhanced@^2.2.1
。如果我执行以下npm install命令,一切正常:
sudo npm install -g @nodelib/fs.stat
+ @nodelib/fs.stat@1.1.0
added 1 package in 0.481s
sudo npm install -g @mrmlnc/readdir-enhanced@^2.2.1
+ @mrmlnc/readdir-enhanced@2.2.1
added 3 packages in 2.178s
但是我必须配置.npmrc文件来引用我的nexus npm存储库,如下所示:
~/.npmrc:
registry=http://mynexus.com/repository/npmrepo
现在当我尝试安装我的私有项目npm install -g generator-myyeomangenerator
时,它失败了,因为它无法下载这些依赖项。
事实上,现在我已经设置了我的.npmrc配置,如果我直接执行npm install来安装这些依赖项,我会收到404错误:
sudo npm install -g @nodelib/fs.stat
npm ERR! code E404
npm ERR! 404 Not Found: @nodelib/fs.stat@latest
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/myuser/.npm/_logs/2018-06-04T21_55_56_792Z-debug.log
日志文件没有提供额外的信息。
除了这些依赖项,通过npm仓库运行一些其他安装也可以正常工作:
sudo npm install -g jav
+ jav@1.0.2
added 71 packages in 9.628s
这似乎与依赖项的@命名有关,这是另一个执行失败的示例:
npm install -g @angular/common@2.4.10
npm ERR! code E404
npm ERR! 404 Not Found: @angular/common@2.4.10
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/myuser/.npm/_logs/2018-06-04T22_01_02_384Z-debug.log
我该怎样解决这个问题?