我正在尝试在linux kubuntu上安装gulp,但是我有这样的问题

时间:2019-03-30 09:24:42

标签: node.js gulp npm-install

我安装了node和npm,但无法安装gulp

成功安装node和npm后,我尝试了npm install -g gulp

npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/lib/node_modules']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dilmurod/.npm/_logs/2019-03-30T09_01_16_977Z-debug.log```

1 个答案:

答案 0 :(得分:0)

默认情况下,当您使用g标志运行npm install package_name -g时,它会存储在 / usr / lib / node_modules / 文件夹中

如果正在执行命令npm install -g的当前用户不具有对/ usr / lib /

的写入权限,则会出现此错误。

使用 root用户sudo npm install gulp -g

执行此操作