简体   繁体   English

手动安装NPM包

[英]Manually installing NPM packages

I used the node windows installer v0.8.3 to install nodejs. 我使用节点Windows安装程序v0.8.3来安装nodejs。 When I try to install express like this: 当我尝试像这样安装快递:

npm install express

It's not working. 它不起作用。 I think that is because my company is using a proxy, so I downloaded express from github https://github.com/visionmedia/express , but I don't know how to install. 我想这是因为我的公司正在使用代理,所以我从github https://github.com/visionmedia/express下载了express,但我不知道如何安装。

I unzip the file and put them in F/express/. 我解压缩文件并将它们放在F / express /中。 Please help me? 请帮我? I'm on Windows 我在Windows上

When I try to install from F:/express/ using the following commands 当我尝试使用以下命令从F:/ express /安装时

cd F:/express
npm install ./express

or 要么

npm install .

I get the following error: 我收到以下错误:

error: connect ETIMEDOUT
at errnoException (net.js:776:11)
at Object.afterConnect [as oncomplete] (net.js:767:19)

And when when I try to do 当我尝试做的时候

npm install F:/express

It shows 表明

express@3.0.0beta7 prepublish F:/express/
npm prune

followed by lots of http get messages and then the same error 然后是大量的http get消息,然后是同样的错误

express itself has a lot of dependencies which I believe npm also tries to retrieve if you issue npm install . express本身有很多依赖项,我相信如果你发出npm install npm也会尝试检索。 I think you should just configure proxy properly => http://jjasonclark.com/how-to-setup-node-behind-web-proxy ? 我认为你应该正确配置代理=> http://jjasonclark.com/how-to-setup-node-behind-web-proxy

It would probably be most convenient long-term to configure NPM to use the aforementioned proxy through one of the following methods (In the following, replace $PROXY with your proxy in the form $PROTOCOL://$DOMAIN:$PORT (eg http://proxy.server:80 )) 通过以下方法之一配置NPM以使用上述代理可能是最方便的长期(在下文中,使用$ PROTOCOL:// $ DOMAIN:$ PORT(例如http)形式的代理替换$ PROXY ://proxy.server:80 ))

A. Set the environment variables http_proxy and https_proxy to $PROXY A.将环境变量http_proxy和https_proxy设置为$ PROXY

B. B.

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

If you have trouble getting packages because of a proxy or other internet connection problem then set up the project on another machine. 如果由于代理或其他Internet连接问题而无法获取软件包,请在另一台计算机上设置项目。 Then copy the project over to your target. 然后将项目复制到目标。 It will have all the files that you need. 它将包含您需要的所有文件。

Try npm install .\\express (assuming the express folder is in the current folder). 尝试npm install .\\express (假设express文件夹在当前文件夹中)。

The problem is that express in npm install express is parsed as a package name, while .\\express in npm install .\\express is parsed as a folder name. 问题是, expressnpm install express被解析为一个包名,而.\\expressnpm install .\\express解析为文件夹名称。

You will want to run npm install . 您将需要运行npm install . from within your F:/express/ folder (or npm install -g . for a global install). 从你的F:/express/文件夹(或npm install -g .用于全局安装)。

It looks like you downloaded beta version (3.0.0beta7). 看起来你下载了测试版(3.0.0beta7)。 Try installing the latest stable version (2.5.11): 尝试安装最新的稳定版本(2.5.11):

npm install https://github.com/visionmedia/express/tarball/2.5.11

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

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