简体   繁体   English

NPM开始抛出错误

[英]NPM start throwing errors

Hi I am trying to install and run angular-phonecat project. 嗨,我正在尝试安装和运行angular-phonecat项目。

  1. install git ( windows ) from github 从github安装git(Windows)
  2. Opened git shell.cloned the probject. 打开git shell。关闭probject。
  3. I have node already installed so I opened node console and typed node --version.I got v0.10.9 我已经安装了节点,所以我打开了节点控制台并输入了节点--version。我得到v0.10.9
  4. back to git shell. 回到git shell。 did npm install in the angular-phonecat directory ( to install all dependencies as angular js suggests here: https://docs.angularjs.org/tutorial npm是否已在angular-phonecat目录中安装(按照angular js的建议在此处安装所有依赖项: https ://docs.angularjs.org/tutorial

I got following error then: 然后出现以下错误:

npm ERR! Error: No compatible version found: karma-chrome-launcher@'^0.1.4'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.1.5"]
npm ERR!     at installTargetsError (C:\Program Files (x86)\nodejs\node_modules\
npm\lib\cache.js:709:10)
npm ERR!     at C:\Program Files (x86)\nodejs\node_modules\npm\lib\cache.js:631:
10
npm ERR!     at saved (C:\Program Files (x86)\nodejs\node_modules\npm\node_modul
es\npm-registry-client\lib\get.js:138: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 (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\abc\angular-phonecat
npm ERR! node -v v0.10.9
npm ERR! npm -v 1.2.24
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\abc\angular-phonecat\npm-debug.log
npm ERR! not ok code 0

I have no idea what is wrong ? 我不知道怎么了?

----Nov 3 2014 update----I updated Node to version v0.10.33 and started getting below error when trying npm install on angular-phonecat directory. ---- 2014年11月3日更新----我将Node更新为v0.10.33版本,并尝试在angular-phonecat目录上安装npm时开始出现以下错误。

npm WARN package.json karma-chrome-launcher@0.1.5 No README data npm WARN package.json karma-chrome-launcher@0.1.5没有自述数据

angular-phonecat@0.0.0 postinstall C:\\abc\\angular-phonecat bower install angular-phonecat@0.0.0后安装C:\\ abc \\ angular-phonecat Bower安装

'bower' is not recognized as an internal or external command, operable program or batch file. 'bower'不被识别为内部或外部命令,可操作程序或批处理文件。

npm ERR! angular-phonecat@0.0.0 postinstall: `bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat@0.0.0 postinstall script.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     bower install
npm ERR! You can get their info via:
npm ERR!     npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\abc\angular-phonecat
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\abc\angular-phonecat\npm-debug.log
npm ERR! not ok code 0

Open your package.json file and change "karma-chrome-launcher": "^0.1.4" with "karma-chrome-launcher": "0.1.4", that is, remove the caret. 打开package.json文件,将“ karma-chrome-launcher”:“ ^ 0.1.4”更改为“ karma-chrome-launcher”:“ 0.1.4”,即删除插入符号。 Same with all the dependencies that use that notation. 与使用该符号的所有依赖项相同。 You can see the meaning of the version numbers here. 您可以在此处查看版本号的含义。

https://www.npmjs.org/doc/files/package.json.html#dependencies https://www.npmjs.org/doc/files/package.json.html#dependencies

The ^ character means "Compatible with". ^字符表示“与...兼容”。

You can also try to upgrade node and npm, versions 0.10.9 and 1.2.24 are quite old now, and the ^ character is not supported in that version . 您也可以尝试升级node和npm,版本0.10.9和1.2.24现在已经很旧了, 该版本不支持 ^字符。

Caret was first available in npm from August 2013 and became the default save prefix 6 months later in February 2014. Caret于2013年8月在npm首次提供,并在6个月后的2014年2月成为默认的保存前缀。

Which is npm version 1.3.7. 这是npm版本1.3.7。

If it still does not work try npm cache clear and then npm install again. 如果仍然无法正常运行,请尝试清除npm cache ,然后再次安装npm


If your problem is the proxy you can try npm config set proxy and npm config set https-proxy as described here jjasonclark.com/how-to-setup-node-behind-web-proxy . 如果您的问题是代理,则可以尝试使用npm config set proxy和npm config set https-proxy,如jjasonclark.com/how-to-setup-node-behind-web-proxy所述


Hope this helps. 希望这可以帮助。


Note : I have tried npm install on a fresh copy of this repository myself and it works, although not Windows and versions 0.10.28 and 1.4.9 respectively. 注意 :我自己尝试在该存储库的新副本上安装npm,并且可以工作,尽管Windows和版本0.10.28和1.4.9分别不行。 So the package.json is correct, strictly speaking. 因此,严格来说,package.json是正确的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM