Search code examples
consolesurge.sh

Why does installing Surge Gives an Error?


I'm trying to install Surge by using npm install -global surge but it throws an error as below. Can someone please help?

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/surge/lib/cli.js
npm ERR! dest /usr/local/bin/surge
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'
npm ERR!  [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'] {
npm ERR!   cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'symlink',
npm ERR!     path: '../lib/node_modules/surge/lib/cli.js',
npm ERR!     dest: '/usr/local/bin/surge'
npm ERR!   },
npm ERR!   stack: "Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/surge/lib/cli.js',
npm ERR!   dest: '/usr/local/bin/surge'
npm ERR! }
npm ERR! 
(base) Basaks-MacBook-Air:jamming basakulcay$ npm install -global surge
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/surge/lib/cli.js
npm ERR! dest /usr/local/bin/surge
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'
npm ERR!  [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'] {
npm ERR!   cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'symlink',
npm ERR!     path: '../lib/node_modules/surge/lib/cli.js',
npm ERR!     dest: '/usr/local/bin/surge'
npm ERR!   },
npm ERR!   stack: "Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/surge/lib/cli.js',
npm ERR!   dest: '/usr/local/bin/surge'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
(base) Basaks-MacBook-Air:jamming basakulcay$ pwd
/Users/basakulcay/Desktop/Web Development/Codeacademy/jamming
(base) Basaks-MacBook-Air:jamming basakulcay$ surge
bash: surge: command not found
(base) Basaks-MacBook-Air:jamming basakulcay$ npm install --global surge
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/surge/lib/cli.js
npm ERR! dest /usr/local/bin/surge
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'
npm ERR!  [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'] {
npm ERR!   cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'symlink',
npm ERR!     path: '../lib/node_modules/surge/lib/cli.js',
npm ERR!     dest: '/usr/local/bin/surge'
npm ERR!   },
npm ERR!   stack: "Error: EACCES: permission denied, symlink '../lib/node_modules/surge/lib/cli.js' -> '/usr/local/bin/surge'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/surge/lib/cli.js',
npm ERR!   dest: '/usr/local/bin/surge'
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:
(base) Basaks-MacBook-Air:jamming basakulcay$ npm install surge
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN saveError ENOENT: no such file or directory, open '/Users/basakulcay/Desktop/Web Development/Codeacademy/jamming/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/basakulcay/Desktop/Web Development/Codeacademy/jamming/package.json'
npm WARN jamming No description
npm WARN jamming No repository field.
npm WARN jamming No README data
(base) Basaks-MacBook-Air:jamming basakulcay$ npm install -g surge
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
/usr/local/bin/surge -> /usr/local/lib/node_modules/surge/lib/cli.js
+ [email protected]
updated 1 package in 7.297s

Solution

  • You may try:

    • Reinstall npm with a node version manager
    • Manually change npm’s default directory

    Check this link for more details:

    https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

    I tried to change the npm’s default directory manually and now its working ;)