简体   繁体   English

无法运行npm install

[英]Can't run npm install

In here it says to run npm install , but I get this error when I run sudo npm install . 这里它说要运行npm install ,但是当我运行sudo npm install时出现这个错误。

sudo npm install
npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/mg/package.json'
npm WARN mg No description
npm WARN mg No repository field.
npm WARN mg No README data
npm WARN mg No license field.

without sudo: 没有sudo:

npm install
npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/mg/package.json'
npm WARN mg No description
npm WARN mg No repository field.
npm WARN mg No README data
npm WARN mg No license field.
npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! path /var/www/html/mg/node_modules/.staging
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/var/www/html/mg/node_modules/.staging'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir '/var/www/html/mg/node_modules/.staging']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/var/www/html/mg/node_modules/.staging' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/mg/npm-debug.log

You need to have a package.json file for that to work. 您需要有一个package.json文件才能工作。

You can create it by running: 您可以通过运行来创建它:

npm init

See also: 也可以看看:

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

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