简体   繁体   English

Npm安装在Windows 10上不起作用

[英]Npm install doesn't work on Windows 10

i have an issue with nodejs. 我对nodejs有问题。 I'm trying to install ember.js library through the command line. 我正在尝试通过命令行安装ember.js库。 When i launch "npm install" command this log appear: 当我启动“ npm install”命令时,将显示以下日志:

0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install' ] 2 info using npm@2.11.3 3 info using node@v0.12.7 4 verbose config Skipping project config: C:\\Users\\Antonio/.npmrc. (matches userconfig) 5 verbose readDependencies loading dependencies from C:\\Users\\Antonio\\package.json 6 error install Couldn't read dependencies 7 verbose stack Error: ENOENT, open 'C:\\Users\\Antonio\\package.json' 7 verbose stack at Error (native) 8 verbose cwd C:\\Users\\Antonio 9 error Windows_NT 6.3.9600 10 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 11 error node v0.12.7 12 error npm v2.11.3 13 error path C:\\Users\\Antonio\\package.json 14 error code ENOPACKAGEJSON 15 error errno -4058 16 error package.json ENOENT, open 'C:\\Users\\Antonio\\package.json' 16 error package.json This is most likely not a problem with npm itself. 16 error package.json npm can't find a package.json file in your current directory. 17 verbose exit [ -4058, true ]

I've visited NPM Troubleshooting but i can't found the solution (i tried the three options but nothing happen). 我访问过NPM疑难解答,但找不到解决方案(我尝试了三个选项,但没有任何反应)。 Just to say: there is yet a folder named "npm" in AppData/Roaming. 只是说:AppData / Roaming中还有一个名为“ npm”的文件夹。

The correct way to install ember is: 安装ember的正确方法是:

npm install -g ember-cli
ember new my-app

npm install by itself only works if you have a package.json in the directory where you type it. npm install本身仅在您输入目录的目录中包含package.json时才有效。

I had this same issue trying to install some node modules to a fresh installation of Sails. 我在尝试将某些节点模块安装到Sails的全新安装时遇到了相同的问题。 I found the solution in this link: https://github.com/npm/npm/issues/9676 我在此链接中找到了解决方案: https : //github.com/npm/npm/issues/9676

Just removed node_modules from my root and then npm install again, then I was able to install other modules as well. 刚刚从根目录中删除了node_modules ,然后再次npm install ,那么我也能够安装其他模块。

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

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