量角器错误 - @ types / jasmine'不在npm注册表中

时间:2016-11-08 07:53:56

标签: node.js npm protractor

我正在尝试安装量角器但收到以下错误。 命令: npm install -g protractor

npm ERR! node v4.4.3
npm ERR! npm  v2.15.1
npm ERR! code E404

npm ERR! 404 no such package available : @types/jasmine
npm ERR! 404
npm ERR! 404 '@types/jasmine' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'protractor'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR!     F:\temp\chrome downloads\npm-debug.log

3 个答案:

答案 0 :(得分:4)

我今天遇到了这个问题,我的问题是我在npm配置文件中设置了自定义注册表。你有没有用过" npm set registry"? 如果是这样,您可以手动告诉npm在哪里寻找' @ types'注册表使用以下命令:

npm config set @types:registry https://registry.npmjs.org/

答案 1 :(得分:1)

问题来自于您使用的私有注册表尚未添加对@organization包的支持。 就我而言,我使用的是Sonatype Nexus,而我的版本并没有支持这些类型的软件包。 @Willie Valdez的建议可能是你现在最好的解决方案。

另外,检查主目录或项目目录中是否有.npmrc文件。注册表可能在那里。如果是这种情况,只需将文件重命名为npmrc_bak或其他内容,直到您安装软件包,然后恢复为原始名称。

答案 2 :(得分:0)

您还可以在当前项目中包含一个.npmrc文件,其中包含以下详细信息:

@angular:registry=https://registry.npmjs.org
@types:registry=https://registry.npmjs.org
@ngtools:registry=https://registry.npmjs.org
@angular-cli:registry=https://registry.npmjs.org

在新项目中方便使用。