无法运行npm install [英] Can't run npm install
本文介绍了无法运行npm install的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此处它说要运行 npm install
,但是运行 sudo npm install
时出现此错误.
In here it says to run npm install
, but I get this error when I run 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.
没有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
推荐答案
您需要具有一个 package.json
文件,该文件才能正常工作.
You need to have a package.json
file for that to work.
您可以通过运行以下命令来创建它:
You can create it by running:
npm init
另请参阅:
这篇关于无法运行npm install的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文