升级 Node.js 8 后,npm 安装包时出错:\_cacache is not a legal HTTP header value
发布于 7 年前 作者 sufangyu 6591 次浏览 来自 问答

升级 Node.js 8 后,npm 安装包时出现以下错误,请问该如何解决?

AppData\Roaming\npm-cache_cacache is not a legal HTTP header value

360截图20170614225738447.jpg

5 回复

npm 升级到 5.0.3 可以解决这个问题,想知道问题在哪可以看一下这个 PR— https://github.com/npm/npm/commit/64f0105e81352b42b72900d83b437b90afc6d9ce

@OneNewLife npm 已经是 5.0.3 版本了,还是没有解决这个问题。 360截图20170615230930138.jpg

@sufangyu 可以贴一下 logs 么?先试试 8.0.0 行不行,npm 用默认安装版本,不要升级,8.1.0 + 还有好多问题

@OneNewLife

现在基本上是安装命令用不了

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using npm@5.0.0
3 info using node@v8.0.0
4 silly install runPreinstallTopLevelLifecycles
5 silly preinstall vue-cnode@1.0.0
6 info lifecycle vue-cnode@1.0.0~preinstall: vue-cnode@1.0.0
7 silly lifecycle vue-cnode@1.0.0~preinstall: no script for preinstall, continuing
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 silly install loadAllDepsIntoIdealTree
14 silly fetchPackageMetaData error for babel-helper-vue-jsx-merge-props@^2.0.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
15 silly fetchPackageMetaData error for babel-eslint@^7.1.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
16 silly fetchPackageMetaData error for babel-plugin-syntax-jsx@^6.18.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
17 silly fetchPackageMetaData error for autoprefixer@^6.7.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
18 silly fetchPackageMetaData error for babel-preset-env@^1.2.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
19 silly fetchPackageMetaData error for babel-plugin-transform-runtime@^6.22.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
20 silly fetchPackageMetaData error for babel-core@^6.22.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
21 silly fetchPackageMetaData error for babel-loader@^6.2.10 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
22 silly fetchPackageMetaData error for babel-plugin-istanbul@^3.1.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
23 silly fetchPackageMetaData error for babel-plugin-transform-vue-jsx@^3.4.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
24 silly fetchPackageMetaData error for babel-register@^6.22.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
25 silly fetchPackageMetaData error for babel-preset-es2015@^6.24.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
26 silly fetchPackageMetaData error for chai@^3.5.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
27 silly fetchPackageMetaData error for chalk@^1.1.3 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
28 silly fetchPackageMetaData error for chromedriver@^2.27.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
29 silly fetchPackageMetaData error for babel-preset-stage-2@^6.22.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
30 silly fetchPackageMetaData error for cross-env@^3.1.4 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
31 silly fetchPackageMetaData error for copy-webpack-plugin@^4.0.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
32 silly fetchPackageMetaData error for connect-history-api-fallback@^1.3.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
33 silly fetchPackageMetaData error for css-loader@^0.26.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
34 silly fetchPackageMetaData error for cross-spawn@^5.0.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
35 silly fetchPackageMetaData error for eslint@^3.14.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
36 silly fetchPackageMetaData error for eslint-plugin-html@^2.0.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
37 silly fetchPackageMetaData error for eslint-import-resolver-webpack@^0.8.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
38 silly fetchPackageMetaData error for eslint-friendly-formatter@^2.0.7 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
39 silly fetchPackageMetaData error for eslint-plugin-import@^2.2.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
40 silly fetchPackageMetaData error for express@^4.14.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
41 silly fetchPackageMetaData error for eventsource-polyfill@^0.9.6 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
42 silly fetchPackageMetaData error for eslint-loader@^1.6.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
43 silly fetchPackageMetaData error for eslint-config-airbnb-base@^11.0.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
44 silly fetchPackageMetaData error for friendly-errors-webpack-plugin@^1.1.3 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
45 silly fetchPackageMetaData error for extract-text-webpack-plugin@^2.0.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
46 silly fetchPackageMetaData error for html-webpack-plugin@^2.28.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
47 silly fetchPackageMetaData error for function-bind@^1.1.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
48 silly fetchPackageMetaData error for file-loader@^0.10.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
49 silly fetchPackageMetaData error for http-proxy-middleware@^0.17.3 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
50 silly fetchPackageMetaData error for inject-loader@^2.0.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
51 silly fetchPackageMetaData error for karma@^1.4.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
52 silly fetchPackageMetaData error for karma-coverage@^1.1.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
53 silly fetchPackageMetaData error for karma-phantomjs-launcher@^1.0.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
54 silly fetchPackageMetaData error for karma-sinon-chai@^1.2.4 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
55 silly fetchPackageMetaData error for karma-sourcemap-loader@^0.3.7 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
56 silly fetchPackageMetaData error for karma-webpack@^2.0.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
57 silly fetchPackageMetaData error for karma-mocha@^1.3.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
58 silly fetchPackageMetaData error for lolex@^1.5.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
59 silly fetchPackageMetaData error for karma-spec-reporter@0.0.26 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
60 silly fetchPackageMetaData error for mocha@^3.2.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
61 silly fetchPackageMetaData error for opn@^4.0.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
62 silly fetchPackageMetaData error for optimize-css-assets-webpack-plugin@^1.3.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
63 silly fetchPackageMetaData error for node-sass@^4.5.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
64 silly fetchPackageMetaData error for nightwatch@^0.9.12 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
65 silly fetchPackageMetaData error for sass-loader@^6.0.3 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
66 silly fetchPackageMetaData error for rimraf@^2.6.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
67 silly fetchPackageMetaData error for phantomjs-prebuilt@^2.1.14 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
68 silly fetchPackageMetaData error for ora@^1.1.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
69 silly fetchPackageMetaData error for selenium-server@^3.0.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
70 silly fetchPackageMetaData error for semver@^5.3.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
71 silly fetchPackageMetaData error for vue-loader@^11.1.4 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
72 silly fetchPackageMetaData error for url-loader@^0.5.7 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
73 silly fetchPackageMetaData error for sinon-chai@^2.8.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
74 silly fetchPackageMetaData error for sinon@^1.17.7 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
75 silly fetchPackageMetaData error for vue-style-loader@^2.0.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
76 silly fetchPackageMetaData error for vue-template-compiler@^2.2.4 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
77 silly fetchPackageMetaData error for webpack-hot-middleware@^2.16.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
78 silly fetchPackageMetaData error for webpack-bundle-analyzer@^2.2.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
79 silly fetchPackageMetaData error for webpack-merge@^2.6.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
80 silly fetchPackageMetaData error for axios@^0.16.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
81 silly fetchPackageMetaData error for webpack@^2.2.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
82 silly fetchPackageMetaData error for webpack-dev-middleware@^1.10.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
83 silly fetchPackageMetaData error for vue@^2.2.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
84 silly fetchPackageMetaData error for mavon-editor@^1.5.8 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
85 silly fetchPackageMetaData error for moment@^2.18.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
86 silly fetchPackageMetaData error for vue-lazyload@^1.0.3 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
87 silly fetchPackageMetaData error for vue-router@^2.2.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
88 silly fetchPackageMetaData error for vue-infinite-loading@^2.0.4 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
89 silly fetchPackageMetaData error for vuex@^2.3.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
90 silly fetchPackageMetaData error for vue-simplemde@^0.3.8 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
91 silly fetchPackageMetaData error for vue-infinite-loading@^2.0.4 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
92 silly fetchPackageMetaData error for axios@^0.16.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
93 silly fetchPackageMetaData error for moment@^2.18.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
94 silly fetchPackageMetaData error for mavon-editor@^1.5.8 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
95 silly fetchPackageMetaData error for vue@^2.2.2 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
96 silly fetchPackageMetaData error for vue-lazyload@^1.0.3 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
97 silly fetchPackageMetaData error for vue-simplemde@^0.3.8 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
98 silly fetchPackageMetaData error for vue-router@^2.2.0 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
99 silly fetchPackageMetaData error for vuex@^2.3.1 C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
100 verbose stack TypeError: C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
100 verbose stack     at sanitizeValue (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\headers.js:24:11)
100 verbose stack     at Headers.set (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\headers.js:141:38)
100 verbose stack     at addCacheHeaders (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\cache.js:253:14)
100 verbose stack     at cacache.get.info.then.then.info (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\cache.js:57:9)
100 verbose stack     at tryCatcher (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
100 verbose stack     at Promise._settlePromiseFromHandler (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
100 verbose stack     at Promise._settlePromise (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
100 verbose stack     at Promise._settlePromise0 (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
100 verbose stack     at Promise._settlePromises (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
100 verbose stack     at Promise._fulfill (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
100 verbose stack     at Promise._resolveCallback (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:432:57)
100 verbose stack     at Promise._settlePromiseFromHandler (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:524:17)
100 verbose stack     at Promise._settlePromise (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
100 verbose stack     at Promise._settlePromise0 (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
100 verbose stack     at Promise._settlePromises (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
100 verbose stack     at Promise._fulfill (D:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
101 verbose cwd G:\VueJS\vue-cnode
102 verbose Windows_NT 10.0.14393
103 verbose argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
104 verbose node v8.0.0
105 verbose npm  v5.0.0
106 error C:\Users\方雨\AppData\Roaming\npm-cache\_cacache is not a legal HTTP header value
107 verbose exit [ 1, true ]

npm cache clean && npm install

回到顶部