为什么安装Surge会出现错误?

时间:2020-06-11 12:23:54

标签: console surge.sh

我正在尝试使用npm install -global surge安装Surge 但它会引发如下错误。有人可以帮忙吗?

npm WARN deprecated request@2.88.2: 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 request@2.88.2: 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 request@2.88.2: 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 request@2.88.2: 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 request@2.88.2: 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
+ surge@0.21.3
updated 1 package in 7.297s

1 个答案:

答案 0 :(得分:0)

您可以尝试:

  • 使用节点版本管理器重新安装npm
  • 手动更改npm的默认目录

检查此链接以获取更多详细信息:

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

我尝试手动更改npm的默认目录,现在可以正常工作了;)