2016-01-19 82 views
0

我是新来的NodeJS,我试图安装快递作为一个依赖,但如下使我的错误::Express安装问题

C:\wamp\www\ExpressJS\node>npm install express --save 
npm ERR! Windows_NT 10.0.10240 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\ 
node_modules\\npm\\bin\\npm-cli.js" "install" "express" "--save" 
npm ERR! node v5.3.0 
npm ERR! npm v3.3.12 
npm ERR! code ENOSELF 

npm ERR! Refusing to install express as a dependency of itself 
npm ERR! 
npm ERR! If you need help, you may report this error at: 
npm ERR!  <https://github.com/npm/npm/issues> 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\wamp\www\ExpressJS\node\npm-debug.log 

**any help would be much appericiated, This is my npm-debug file** 

回答

0

您正在运行npm i express --save位于ExpressJS文件夹内。请出去并在那里安装express

0

启动节点项目时,需要在目标文件夹中使用命令npm init。然后安装express模块​​。

0

谢谢,但我解决了这个问题....我运行相同的命令,它安装。但在我看来,表达式发生器安装在表达式中......并且它跟你站在哪个文件夹无关... ExpressJs是我的父文件夹。

0

好,我知道了什么是你确切的问题,那就是,同时通过

NPM初始化

你给的名字作为依赖名称创建项目。

因此,通过进入package.json来更改项目名称,并给出不同的名称。 然后再通过同样的命令 像

NPM英索尔--save

安装,我可以预言,你可能不会再得到同样的错误