Tôi đang cố gắng để cài đặt ESLint với NPM bằng cách:Lỗi: EACCES: cho phép từ chối khi cố gắng cài đặt ESLint sử dụng NPM
npm install -g eslint
Tuy nhiên tôi nhận được lỗi sau:
Deans-Air:~ deangibson$ npm install -g eslint
npm ERR! tar.unpack untar error /Users/deangibson/.npm/eslint/2.4.0/package.tgz
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "eslint"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! path /usr/local/lib/node_modules/eslint
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/eslint'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/eslint']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/eslint',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/eslint',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:82:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/deangibson/npm-debug.log
Và thành thật mà nói tôi nhận được điều này mỗi lần tôi thử và cài đặt một cái gì đó với npm. Đôi khi sử dụng 'sudo' hoạt động, đôi khi nó không ... Làm thế nào tôi có thể sửa lỗi này một lần và cho tất cả?
Tôi khá chắc chắn rằng đây là lệnh tôi chạy đã phá vỡ sudo trên pi của tôi. Tôi bây giờ phải cài đặt lại pi của tôi. Tôi mới dùng Linux nên tôi biết có nguy cơ chạy các lệnh mà tôi không hiểu. – Roaders