2

我只是想在 Mac 上执行 sudo npm install ,具有以下依赖项:

"devDependencies": {
   "grunt": "~0.4.2",
   "grunt-contrib-jshint": "~0.6.3",
   "grunt-contrib-nodeunit": "~0.6.3",
   "grunt-contrib-uglify": "~0.6.3"
},

但 npm 一直告诉我:

npm ERR! notarget No compatible version found: grunt-contrib-uglify@'>=0.6.3-0 <0.7.0-0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.1.1","0.1.2","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.2.7","0.1.1-rc5","0.1.1-rc6"]

当我确定我想要的版本存在时,uglify 也会发生同样的事情,并且我在 Windows 上的朋友能够使用相同的 package.json 进行安装就好了

我担心我的版本,所以我安装了最新版本的 node 和 npm,然后运行 ​​sudo npm update npm -g,没有解决问题

109 error node -v v0.10.22
110 error npm -v 1.3.15
111 error code ETARGET
112 verbose exit [ 1, true ]

以及来自调试日志的更多内容

97 silly addNameRange number 2 { name: 'grunt-contrib-uglify',
97 silly addNameRange   range: '>=0.6.3-0 <0.7.0-0',
97 silly addNameRange   hasData: true }
98 silly addNameRange versions [ 'grunt-contrib-uglify',
98 silly addNameRange   [ '0.1.0',
98 silly addNameRange     '0.1.1',
98 silly addNameRange     '0.1.2',
98 silly addNameRange     '0.2.0',
98 silly addNameRange     '0.2.1',
98 silly addNameRange     '0.2.2',
98 silly addNameRange     '0.2.3',
98 silly addNameRange     '0.2.4',
98 silly addNameRange     '0.2.5',
98 silly addNameRange     '0.2.6',
98 silly addNameRange     '0.2.7',
98 silly addNameRange     '0.1.1-rc5',
98 silly addNameRange     '0.1.1-rc6' ] ]
99 silly lockFile 9c3f05fb-grunt-contrib-uglify-0-6-3 grunt-contrib-uglify@~0.6.3
100 silly lockFile 9c3f05fb-grunt-contrib-uglify-0-6-3 grunt-contrib-uglify@~0.6.3

101 silly addNameRange number 2 { name: 'grunt-contrib-nodeunit',
101 silly addNameRange   range: '>=0.6.3-0 <0.7.0-0',
101 silly addNameRange   hasData: true }
102 silly addNameRange versions [ 'grunt-contrib-nodeunit',
102 silly addNameRange   [ '0.1.0',
102 silly addNameRange     '0.1.1',
102 silly addNameRange     '0.1.2',
102 silly addNameRange     '0.2.0',
102 silly addNameRange     '0.2.1',
102 silly addNameRange     '0.2.2',
102 silly addNameRange     '0.1.2-rc5',
102 silly addNameRange     '0.1.2-rc6' ] ]
103 silly lockFile 77c5bd75-grunt-contrib-nodeunit-0-6-3 grunt-contrib-nodeunit@~0.6.3
104 silly lockFile 77c5bd75-grunt-contrib-nodeunit-0-6-3 grunt-contrib-nodeunit@~0.6.3
105 error notarget No compatible version found: grunt-contrib-uglify@'>=0.6.3-0 <0.7.0-0'
4

2 回答 2

0

试试这个: npm install grunt-contrib-uglify --save-dev...它将最新版本下载到您的计算机并将版本保存到您的 package.json github上有uglify的文档

于 2013-12-06T05:48:33.700 回答
0

您指定您需要:

您应该修复您的package.json版本信息。

于 2013-12-06T10:12:25.440 回答