简体   繁体   English

npm安装不能在Windows 7中工作而不会出现任何错误

[英]npm install not working in windows 7 without giving any error

I am new to node and have installed latest version of nodejs on windows 7 from windows installer for node. 我是node的新手,并且已经从Windows安装程序中为节点安装了最新版本的nodejs。 For me node install is not working without giving any error. 对我来说节点安装不起作用而不给出任何错误。 After giving command 给命令后

npm install -g express

Cursors just waits and waits without showing any error message node(v 0.12.2) and npm(v2.7.4) 游标只是等待并等待而不显示任何错误消息节点(v 0.12.2)和npm(v2.7.4)
Any help is highly appreciated. 任何帮助都非常感谢。 Thanks!! 谢谢!!

had the same problem once, in case you installed some node packages before and there is already an node_modules folder try to delete it manually and rerun the npm install command. 有一个相同的问题,如果您之前安装了一些节点包,并且已经有一个node_modules文件夹尝试手动删除它并重新运行npm install命令。

alternatively try to create a package.json file like this: 或者尝试创建一个这样的package.json文件:

package.json 的package.json

{
  "name": "module-name",
  "version": "1.0.0",
  "description": "",
  "author": "Your Name",
  "dependencies": {
    "express": "4.2.x"
  },
  "license": ""
}

and run npm install in that folder 并在该文件夹中运行npm install

EDIT: just mentioned you try to install express globally, this is not needed, express is installed via npm install express --save (--save creates a dependency in the package.json file). 编辑:刚刚提到你试图全局安装快递,这是不需要的, 快递是通过npm install express --save (--save在package.json文件中创建一个依赖项)。

npm install express --save

express-generator 快递发电机

Another option would be to install the express-generator ,this one is installed globally ;) 另一个选择是安装快速发电机 ,这个全局安装;)

npm install express-generator -g

and generate your initial project this way 并以这种方式生成您的初始项目

在此输入图像描述

check the proxy settings. 检查代理设置。
npm config get proxy npm config获取代理

If proxy is correct then you might had cancelled the installation in the middle. 如果代理是正确的,那么您可能已经取消了中间的安装。

If you had done so, delete the folder named "node_modules" in your current directory (installation folder)which will be created while installation. 如果已执行此操作,请删除当前目录 (安装文件夹)中名为“node_modules”的文件夹,该文件夹将在安装时创建。

and restart the install (type npm install ) 并重新启动安装(键入npm install)

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

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