gpt4 book ai didi

node.js - Npm 肯定不行

转载 作者:行者123 更新时间:2023-12-04 19:03:44 25 4
gpt4 key购买 nike

每次我尝试用 NPM 做某事时,它都不起作用。我用 version 0.10.7 安装了 Node 和 npm version 1.2.21 .我需要安装 CoffeeScript ,它给了我这个错误:

npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm ERR! network tunneling socket could not be established, cause=getaddrinfo ENOTFOUND
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! System Linux 3.5.0-39-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! cwd /home/sasuke/Videos/Node.js/Ex_Files_Node.js_FL/Exercise Files/3 Modules
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! code ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/sasuke/Videos/Node.js/Ex_Files_Node.js_FL/Exercise Files/3 Modules/npm-debug.log
npm ERR! not ok code 0

我看过这个链接:
https://github.com/isaacs/npm/issues/2677
但是在我尝试检查代理后,我得到了这个:
~ > npm config get proxy
proxy-url:port
~ > npm config get https-proxy
proxy-url:port

后来在那篇帖子中,有人说要在 /usr/local/etc/npmrc 更改 token 但我没有那个文件。之后我将 Node 更新为 v0.10.18但我仍然有同样的错误。我正在使用 Ubuntu 12.04,但我仍然不知道如何解决这个问题。请帮忙。

编辑问题:
我已删除 npm proxynpm https-proxy现在已经安装了coffeescript,但显示了一些警告
sudo npm install -g coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http 200 https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.3.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.3.tgz
/usr/local/bin/coffee -> /usr/local/lib/node_modules/coffee-script/bin/coffee
/usr/local/bin/cake -> /usr/local/lib/node_modules/coffee-script/bin/cake
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/couch-login requires request@'~2.9.202' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/request,
npm WARN unmet dependency which is version 2.25.0
coffee-script@1.6.3 /usr/local/lib/node_modules/coffee-script

在我输入咖啡后,它就存在并给了我 REPL 提示。即使在安装时出现这些警告,这是否仍能正常工作?

最佳答案

解决方案在这里:

Manually installing NPM packages

npm set proxy $PROXY
npm set https-proxy $PROXY

关于node.js - Npm 肯定不行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18907020/

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