首页 > 解决方案 > npm install 返回 304 和 404 错误而不是安装包

问题描述

当我跑步时,npm install我会看到很多这样的:

npm http fetch GET 304 http://registry.npmjs.org/is-arrayish 60ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/spdx-license-ids 67ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/spdx-exceptions 72ms (from cache)
npm http fetch GET 200 http://registry.npmjs.org/arr-union 11ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/is-buffer 68ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/is-data-descriptor 85ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/is-accessor-descriptor 90ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/is-accessor-descriptor 72ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/is-data-descriptor 66ms (from cache)
npm http fetch GET 200 http://registry.npmjs.org/has-value 6ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/p-try 92ms (from cache)
npm http fetch GET 200 http://registry.npmjs.org/set-value 12ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/posix-character-classes 68ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/static-extend 88ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/for-in 89ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/get-value 72ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/collection-visit 88ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/to-object-path 64ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/union-value 85ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/os-homedir 81ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/unset-value 87ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/delegates 76ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/aproba 82ms (from cache)
npm http fetch GET 200 http://registry.npmjs.org/map-visit 8ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/has-unicode 76ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/wide-align 73ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/capture-stack-trace 69ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/prepend-http 83ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/has-values 81ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/object-copy 61ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/object-visit 53ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/code-point-at 52ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/pseudomap 84ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/has-values 53ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/copy-descriptor 42ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/number-is-nan 76ms (from cache)
npm http fetch GET 404 http://registry.npmjs.org/@apollographql%2fapollo-tools 726ms
npm timing stage:rollbackFailedOptional Completed in 0ms
npm timing stage:runTopLevelLifecycles Completed in 6589ms
npm ERR! code E404
npm ERR! 404 Not Found: @apollographql/apollo-tools@^0.4.0
npm timing npm Completed in 6995ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/paulcarron/.npm/_logs/2019-10-01T19_18_38_895Z-debug.log

我不确定为什么我的包无法安装。我有一个模糊的回忆,我在一段时间前更新了 npm url,但这里的 url 看起来不错。有什么建议么?

标签: javascriptnode.jsnpm

解决方案


到了它的底部。我删除了我的应用程序文件夹的内容并将一组新的程序文件复制到其中。我没有注意到的是,当我删除我的终端时,我的终端遵循了我已删除文件的路径,因此基本上指向垃圾桶中的一个位置,这似乎导致了npm install.

更改到正确的目录并npm install再次运行解决了该问题。


推荐阅读