node.jslinuxnetlifynetlify-cli

Unable to install Netlify-Cli


i was trying to install Netlify-Cli using Linux Terminal.
I tried this command:

npm install netlify-cli -g

But it is throwing some error

> yarn@1.22.10 preinstall /usr/local/lib/node_modules/netlify-cli/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/netlify-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-win32-x64@0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-win32-x64@0.27.10: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-darwin-x64@0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-darwin-x64@0.27.10: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})

npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/netlify-cli/bin/run
npm ERR! dest /usr/local/bin/netlify
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify'
npm ERR!  { [Error: EACCES: permission denied, symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify']
npm ERR!   cause:
npm ERR!    { Error: EACCES: permission denied, symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify'
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'symlink',
npm ERR!      path: '../lib/node_modules/netlify-cli/bin/run',
npm ERR!      dest: '/usr/local/bin/netlify' },
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, symlink \'../lib/node_modules/netlify-cli/bin/run\' -> \'/usr/local/bin/netlify\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/netlify-cli/bin/run',
npm ERR!   dest: '/usr/local/bin/netlify' }
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/silence/.npm/_logs/2021-05-09T13_28_21_198Z-debug.log

If any small help would be helpful.


Solution

  • Thanks to boirslav popov.
    As he mentioned in his answer it has worked for some of them ie,

    sudo npm install netlify-cli -g

    But sadly it didn't work for me :(

    For those, if the above command didn't work can follow the attached answer :D Answer

    I followed this answer

    i.e,

    sudo npm install -g --unsafe-perm=true netlify-cli