I am trying to install json-server
by using npm install -g json-server
command on Mac but am getting the following error:
(node:34559) ExperimentalWarning: CommonJS module /usr/local/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /usr/local/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Usenode --trace-warnings ...
to show where the warning was created)
npm error code EACCES
npm error syscall rename
npm error path /usr/local/lib/node_modules/json-server
npm error dest /usr/local/lib/node_modules/.json-server-SmlbN4FS
npm error errno -13
npm error Error: EACCES: permission denied, rename ‘/usr/local/lib/node_modules/json-server’ -> ‘/usr/local/lib/node_modules/.json-server-SmlbN4FS’
npm error at async Object.rename (node:internal/fs/promises:784:10)
npm error at async moveFile (/usr/local/lib/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js:30:5)
npm error at async Promise.allSettled (index 0)
npm error at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11)
npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5)
npm error at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9)
npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5) {
npm error errno: -13,
npm error code: ‘EACCES’,
npm error syscall: ‘rename’,
npm error path: ‘/usr/local/lib/node_modules/json-server’,
npm error dest: ‘/usr/local/lib/node_modules/.json-server-SmlbN4FS’
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It is likely you do not have the permissions to access this file as the current user
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error A complete log of this run can be found in: /Users/fllap0630_mayurpatil/.npm/_logs/2024-12-05T17_07_36_861Z-debug-0.log
Mayur Patil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.