【问题标题】:mac sudo npm install -g protractor Error 404mac sudo npm install -g protractor 错误 404
【发布时间】:2017-06-07 04:53:17
【问题描述】:

当我运行 sudo npm install -g protractor 时,出现错误,看起来好像没有那个文件夹/文件。有没有人知道如何解决这个问题?非常感谢:)

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "protractor"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code E404

npm ERR! 404 no such package available : @types/node
npm ERR! 404 
npm ERR! 404  '@types/node' 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 install screenshot

【问题讨论】:

  • 即使我将 node 更新到 v7.4.0 并将 npm 更新到 4.1.1,同样的错误,'@type/node' 不在 npm 注册表中

标签: angularjs npm protractor


【解决方案1】:

一些有同样问题的人发现将版本降低到 4.0.4 会有所帮助。 Buts 似乎是一个常见的错误。仍然不是一个很酷的解决方案,但似乎对某些人有用。

【讨论】:

  • 那么还有其他方法可以解决吗?谢谢:)
【解决方案2】:

这可以在节点 6.9.2 上重现。我相信这个版本的节点在 npm 中是一个错误。

❯ nvm install 6.9.2                                                                                                                                 ⏎
Downloading https://nodejs.org/dist/v6.9.2/node-v6.9.2-darwin-x64.tar.xz...
######################################################################## 100.0%
WARNING: checksums are currently disabled for node.js v4.0 and later
Now using node v6.9.2 (npm v3.10.9)

❯ npm i - g @types/node
npm ERR! addLocal Could not install /Users/cnishina/-
npm ERR! Darwin 16.3.0
npm ERR! argv "/Users/cnishina/.nvm/versions/node/v6.9.2/bin/node" "/Users/cnishina/.nvm/versions/node/v6.9.2/bin/npm" "i" "-" "g" "@types/node"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! path /Users/cnishina/-
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/Users/cnishina/-'
npm ERR! enoent ENOENT: no such file or directory, open '/Users/cnishina/-'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/cnishina/npm-debug.log

安装6.9.3后,错误消失:

❯ nvm install 6.9.3
Downloading https://nodejs.org/dist/v6.9.3/node-v6.9.3-darwin-x64.tar.xz...
######################################################################## 100.0%
WARNING: checksums are currently disabled for node.js v4.0 and later
npm i -g @tNow using node v6.9.3 (npm v3.10.10)


❯ npm i -g @types/node
/Users/cnishina/.nvm/versions/node/v6.9.3/lib
└── @types/node@7.0.1

我还建议安装最新的node 6。在发这篇文章的时候,它是node 6.9.4。我检查了安装 @types/node 也适用于节点 6.9.4。

【讨论】:

  • 谢谢。但我试过了,更新了 npm 但同样的错误:(
  • 你在使用 npm 缓存层吗?像神器还是关系?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-14
  • 2021-05-15
  • 2013-09-15
  • 1970-01-01
  • 2013-05-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多