This question already has answers here:
npm install -g less does not work: EACCES: permission denied
(14 answers)
Closed 2 years ago.
npm install -g create-react-app
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
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! /home/legend/.npm/_logs/2020-05-04T08_45_14_806Z-debug.log
You need admin permissions for installing a module globally, run the command with sudo:
sudo npm install -g create-react-app
Related
I have been struggling to install Vanilla for JavaScript. According to the instructions I have to use the command npm install --global serve, when I do that, errors fill the screen saying I don't have permission etc.
Also I have tried using --location=global as they suggested.
Error messages are attached below:
Windows10#MacBook-Air ~ % npm install --global serve
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/serve
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/serve'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/serve'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/serve'
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/Windows10/.npm/_logs/2022-09-07T16_30_32_036Z-debug-0.log
Windows10#MacBook-Air ~ %
I'm trying to install a new bootstrap theme locally and install the javascript packages with npm as per the theme's instructions: https://prium.github.io/twbs-sparrow/documentation/getting-started.html
However, when i run the code, I get an error about permissions:
MacBook:node_modules HeatherDannyelle$ npm i gulp-cli -g
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/gulp-cli/bin/gulp.js
npm ERR! dest /usr/local/bin/gulp
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/gulp-cli/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR! [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/gulp-cli/bin/gulp.js' -> '/usr/local/bin/gulp'] {
npm ERR! cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/gulp-cli/bin/gulp.js' -> '/usr/local/bin/gulp'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/gulp-cli/bin/gulp.js',
npm ERR! dest: '/usr/local/bin/gulp'
npm ERR! },
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/gulp-cli/bin/gulp.js',
npm ERR! dest: '/usr/local/bin/gulp'
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/HeatherDannyelle/.npm/_logs/2020-11-21T14_21_43_400Z-debug.log
Relatively new to programming and currently trying to install create-react-app with npm and its giving me this output:
jacobb$ npm install -g create-react-app
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
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/jacobb/.npm/_logs/2019-12-04T22_00_50_323Z-debug.log
I've checked permissions and the folder is able to be accessed by everyone, so I don't think that's the issue. I looked up other questions related to this on the site and I wasn't sure if they were the same since everyone else's output seemed to be different. Apologies if this is the same as another question I've missed.
npm WARN checkPermissions Missing write access to /Users/josephmonreal/node_modules
npm WARN enoent ENOENT: no such file or directory, open '/Users/josephmonreal/package.json'
npm WARN josephmonreal No description
npm WARN josephmonreal No repository field.
npm WARN josephmonreal No README data
npm WARN josephmonreal No license field.
npm ERR! path /Users/josephmonreal/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/josephmonreal/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/Users/josephmonreal/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/Users/josephmonreal/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/josephmonreal/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/josephmonreal/.npm/_logs/2019-10-07T02_13_49_224Z-debug.log
I'm now getting this when trying to run npm i:
npm i
npm ERR! path /home/ole/.npm/_cacache/index-v5/37/b4
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/home/ole/.npm/_cacache/index-v5/37/b4'
npm ERR! [OperationalError: EACCES: permission denied, mkdir '/home/ole/.npm/_cacache/index-v5/37/b4'] {
npm ERR! cause: [Error: EACCES: permission denied, mkdir '/home/ole/.npm/_cacache/index-v5/37/b4'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/home/ole/.npm/_cacache/index-v5/37/b4'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! stack: 'Error: EACCES: permission denied, mkdir ' +
npm ERR! "'/home/ole/.npm/_cacache/index-v5/37/b4'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/home/ole/.npm/_cacache/index-v5/37/b4',
npm ERR! parent: 'config-chain'
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 (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ole/.npm/_logs/2019-05-14T21_15_39_992Z-debug.log
I've tried changing the ownership and permission of the files and deleting node_modules in the project directory but none of these steps work. Thoughts?
There is an issue with installing global packages using sudo leaving behind files with the wrong ownership.
The short version is run this to fix the ownership, then try your install again:
sudo chown -R $(whoami) ~/.npm
The long version and canonical bug is: https://npm.community/t/global-installs-sudo-npm-i-g-fail-on-mac-after-6-5-upgrade-works-fine-after-6-4-1-downgrade/4082