在Linux中创建package.json时出错

时间:2019-01-15 16:06:29

标签: reactjs npm babel

我正在尝试使用命令创建package.json文件:

npm init

在linux实例上安装babel之后,出现错误:

npm ERR! argv "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/node" "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/npm" "init"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! path /var/www/html/package.json
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open

npm ERR! Error: EACCES: permission denied, open '/var/www/html/package.json'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, open '/var/www/html/package.json']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: '/var/www/html/package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 4.14.88-88.76.amzn2.x86_64
npm ERR! argv "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/node" "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/npm" "init"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! path npm-debug.log.3130824671
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open

npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.3130824671'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, open 'npm-debug.log.3130824671']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: 'npm-debug.log.3130824671' }
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/npm-debug.log

我无法弄清楚是什么错误。请帮我解决这个问题。

0 个答案:

没有答案