由于版本不可用,npm install 不起作用

npm install doesn't work due to unavailable version

我尝试在 Windows PC 上安装 this wordpress template,它依赖于一些节点模块来生成 gulp 文件。

npm install 的输出如下:

$ npm install
npm WARN package.json gulp-wordpress-template@0.0.1 No repository field.
npm http GET https://registry.npmjs.org/gulp-load-plugins
npm http GET https://registry.npmjs.org/gulp-autoprefixer
npm http GET https://registry.npmjs.org/gulp
npm http GET https://registry.npmjs.org/browser-sync
npm http 304 https://registry.npmjs.org/gulp-autoprefixer
npm ERR! Error: No compatible version found: gulp-autoprefixer@'^1.0.1'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9
","0.0.10","1.0.0","1.0.1","2.0.0","2.1.0"]
npm ERR!     at installTargetsError (c:\Program Files\nodejs\node_modules\npm\li
b\cache.js:719:10)
npm ERR!     at c:\Program Files\nodejs\node_modules\npm\lib\cache.js:638:10
npm ERR!     at saved (c:\Program Files\nodejs\node_modules\npm\node_modules\npm
-registry-client\lib\get.js:142:7)
npm ERR!     at c:\Program Files\nodejs\node_modules\npm\node_modules\graceful-f
s\polyfills.js:133:7
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\Program Files\nodejs\node.exe" "c:\Program Files\nodej
s\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd c:\Users\USER\Desktop\wordpress-test
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm http 304 https://registry.npmjs.org/gulp-load-plugins
npm http 304 https://registry.npmjs.org/gulp
npm http GET https://registry.npmjs.org/gulp-connect-php
npm http GET https://registry.npmjs.org/gulp-shell
npm http GET https://registry.npmjs.org/gulp-sass
npm http 304 https://registry.npmjs.org/browser-sync
npm http 304 https://registry.npmjs.org/gulp-sass
npm http 304 https://registry.npmjs.org/gulp-connect-php
npm http 304 https://registry.npmjs.org/gulp-shell
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     c:\Users\USER\Desktop\wordpress-test\npm-debug.log
npm ERR! not ok code 0

根据错误,gulp-autoprefixer 在版本 ^1.0.1 中不可用。奇怪的是,下面提示 1.0.1 是有效版本。

更奇怪的是,我可以在 OSX 机器上完美安装软件包。

我认为 node 是跨平台的 – 有什么我遗漏的吗?

您需要支持版本字段中 ^ 字符的较新版本的 npm。最简单的方法是只升级节点(在撰写本文时最新的稳定版是 v0.10.35)。