gpt4 book ai didi

angularjs - NPM 开始抛出错误

转载 作者:太空宇宙 更新时间:2023-11-04 01:01:13 26 4
gpt4 key购买 nike

您好,我正在尝试安装并运行 Angular-phonecat 项目。

  1. 从 github 安装 git (windows)
  2. 打开 git shell。克隆项目。
  3. 我已经安装了 Node,因此我打开了 Node 控制台并输入了 Node --version。我得到了 v0.10.9
  4. 返回 git shell。 npm 是否安装在 angular-phonecat 目录中(按照 Angular js 的建议安装所有依赖项: https://docs.angularjs.org/tutorial

然后我收到以下错误:

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

我不知道出了什么问题?

----2014 年 11 月 3 日更新----我将 Node 更新到版本 v0.10.33,并在尝试在 angular-phonecat 目录上安装 npm 时开始出现以下错误。

npm 警告 package.json karma-chrome-launcher@0.1.5 没有自述文件数据

angular-phonecat@0.0.0 postinstall C:\abc\angular-phonecat bower install

“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

最佳答案

打开 package.json 文件并将 "karma-chrome-launcher": "^0.1.4"更改为 "karma-chrome-launcher": "0.1.4",即删除插入符号。与使用该表示法的所有依赖项相同。您可以在此处查看版本号的含义。

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

^ 字符表示“兼容”。

你也可以尝试升级node和npm,版本0.10.9和1.2.24现在已经很旧了,^字符is not supported in that version .

Caret was first available in npm from August 2013 and became the default save prefix 6 months later in February 2014.

这是 npm 版本 1.3.7。

如果仍然不起作用,请尝试npm 缓存清除,然后再次npm install

<小时/>

如果您的问题是代理,您可以尝试 npm config set proxy 和 npm config set https-proxy,如下所述 jjasonclark.com/how-to-setup-node-behind-web-proxy .

<小时/>

希望这有帮助。

<小时/>

注意:我自己尝试过在这个存储库的新副本上进行 npm install,它可以工作,尽管 Windows 和版本 0.10.28 和 1.4.9 分别不行。所以严格来说,package.json 是正确的。

关于angularjs - NPM 开始抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26642989/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com