2016-02-20 83 views
0

我是nodejs的新手。我试图根据文档安装nodejs。在使用npm install命令安装依赖关系时,我遇到了一个错误。npm-install命令不起作用

C:\Program Files\nodejs>npm install 
npm ERR! install Couldn't read dependencies 
npm ERR! Windows_NT 6.3.9600 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\ 
node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! node v4.3.1 
npm ERR! npm v2.14.12 
npm ERR! path C:\Program Files\nodejs\package.json 
npm ERR! code ENOPACKAGEJSON 
npm ERR! errno -4058 
npm ERR! syscall open 

npm ERR! package.json ENOENT: no such file or directory, open 'C:\Program Files\ 
nodejs\package.json' 
npm ERR! package.json This is most likely not a problem with npm itself. 
npm ERR! package.json npm can't find a package.json file in your current directo 
ry. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Program Files\nodejs\npm-debug.log 

C:\Program Files\nodejs> 

其中的package.json文件存在时,它NPM运行在文件夹中安装命令后,给出了这样的错误:

C:\Program Files\nodejs>npm install 
npm ERR! install Couldn't read dependencies 
npm ERR! Windows_NT 6.3.9600 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\ 
node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! node v4.3.1 
npm ERR! npm v2.14.12 
npm ERR! path C:\Program Files\nodejs\package.json 
npm ERR! code ENOPACKAGEJSON 
npm ERR! errno -4058 
npm ERR! syscall open 

npm ERR! package.json ENOENT: no such file or directory, open 'C:\Program Files\ 
nodejs\package.json' 
npm ERR! package.json This is most likely not a problem with npm itself. 
npm ERR! package.json npm can't find a package.json file in your current directo 
ry. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Program Files\nodejs\npm-debug.log 

C:\Program Files\nodejs> 

link for npm-debug log file.. 任何帮助,将不胜感激.. 感谢..

回答

0

您正在运行的文件夹中的NodeJS NPM安装,您应在项目文件夹中运行它。只要确保npm在你的道路上。

+0

运行NPM在文件夹中安装命令,其中包后自动更新.json文件存在时会出现此错误: –

+0

https://drive.google.com/open?id=0BwTgYzZKuzAZZXBNRkFFQWZRVkU –

1

安装依赖关系节点在名为package.json的项目的根目录中寻找一个文件,其中有项目所需的所有依赖项的列表。其内容看起来像something like this

听起来像你缺少package.json在你的项目的根。

安装依赖你通常运行像

npm install NAMEOFTHEDEPENDENCY --save-dev 

一个命令,其中NAMEOFTHEDEPENDENCY可以grunt-contrib-sass例如

这也是你的package.json