Yêu cầu thg 10 12, 2021 12:42 CH 100 0 1
  • 100 0 1
+1

Giúp em với em không thể up json-server về VSCode được

Chia sẻ
  • 100 0 1

Em đã cài nodejs phiên bản mới nhất vào máy rồi, thử các cú pháp rồi nhưng vẫn không thể up json-server về để làm bài tập thầy giao. giúp em với ạ.

Em đã sử dụng lệnh npm i -g json-server rồi nhưng vẫn không được

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/json-server
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/json-server'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/json-server'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/json-server'
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/nguyentinh/.npm/_logs/2021-10-12T12_37_33_820Z-debug.log

1 CÂU TRẢ LỜI


Đã trả lời thg 10 12, 2021 1:20 CH
Đã được chấp nhận
+2

Do em dùng thêm option -g , viết tắt của global nên em cần chạy command dưới quyền root để nó có thể ghi package kia nhé. sudo npm i -g json-server

Chia sẻ
thg 10 12, 2021 4:03 CH
Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí