Imd*_*que 2 javascript json npm reactjs
我正在尝试安装json-server但多次失败,这让我绝望。现在需要帮助来制定解决方案。下面是我在 Ubunto-20.04 操作系统上使用的命令。
虽然首先,我使用了最新版本的nodejs,即15x,但我也遇到了安装错误json-server,下面的命令用于安装json-server
npm install json-server -gnpm install -g json-servernpm i json-server我已使用上述所有命令进行安装json-server,但每次我都会遇到错误,如下所示,
这是错误
checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/imdadul/.npm/_logs/2021-03-18T04_32_41_181Z-debug.log
Run Code Online (Sandbox Code Playgroud)
小智 5
您可以尝试使用 sudo ,如“sudo npm install -g json-server”或使用“chmod -r 777 /usr/local/lib/node_modules”授予写入权限。我认为 sudo 选项更适合即时许可。