当我尝试在nginx虚拟机上运行npm install -g json-server
时,出现此错误:
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "json-server"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path ../lib/node_modules/json-server/lib/cli/bin.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/json-server/lib/cli/bin.js' -> '/usr/local/bin/json-server'
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/json-server/lib/cli/bin.js' -> '/usr/local/bin/json-server'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/json-server/lib/cli/bin.js',
npm ERR! dest: '/usr/local/bin/json-server' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
我已经尝试过sudo chown -R $USER /usr/local/lib/node_modules
,但仍然无法正常工作。我正在使用digitalocean和nginx来部署React应用程序。 React应用程序使用JSON服务器来存储和持久化数据。我正在尝试从项目文件夹中运行命令。我可以安装不带全局标签的json-server,但是当我尝试启动json-server时,我收到一条消息,提示未找到json-server命令。