see
see

Reputation: 71

npm install -g @sanity/cli commend is not working

I tried to run npm install -g @sanity/cli commend to use Sanity but my return is this..

npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/@sanity/cli/bin/sanity
npm ERR! dest /usr/local/bin/sanity
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/@sanity/cli/bin/sanity' -> '/usr/local/bin/sanity'
npm ERR!  [Error: EACCES: permission denied, symlink '../lib/node_modules/@sanity/cli/bin/sanity' -> '/usr/local/bin/sanity'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/@sanity/cli/bin/sanity',
npm ERR!   dest: '/usr/local/bin/sanity'
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!     /Users/kevinsong/.npm/_logs/2022-07-27T17_49_06_969Z-debug-0.log

npm -v 8.13.2

What need to be done to run the npm install -g @sanity/cli?

when I do vi /usr/local/bin, I see this

    node*
    corepack@        --> /usr/local/lib/node_modules/corepack/dist/corepack.js
    npm@     --> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    npx@     --> /usr/local/lib/node_modules/npm/bin/npx-cli.js
    ~ 

Upvotes: 0

Views: 848

Answers (1)

Tanjin Alam
Tanjin Alam

Reputation: 2496

It's because your current user doesn't have the permission

you can check the permission

ls -la /usr/local/lib/node_modules

get the permission for sudo access

sudo chown -R $USER /usr/local/lib/node_modules/

Now try with

sudo npm install -g @sanity/cli

Click HERE for more

Upvotes: 2

Related Questions