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.
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 have this error
D:\>npm install react-router-dom
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:\
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\'
npm ERR! [Error: EPERM: operation not permitted, mkdir 'D:\'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! D:\my-app\AppData\Roaming\npm-cache\_logs\2022-08-07T07_21_15_220Z-debug-0.log
It is a permission Issue.
You're running this command as a non-administrator user.
Open cmd as an administrator
and run this command,
It will work
So I'm logged in as administrator of my MacBook and want to run a npm command in my Django project. However, It refuses due to missing permissions.
(venv) jonas#Air-von-Jonas salaryx % npm install -g sass
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/sass/sass.js
npm ERR! dest /usr/local/bin/sass
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/sass/sass.js' -> '/usr/local/bin/sass'
npm ERR! [Error: EACCES: permission denied, symlink '../lib/node_modules/sass/sass.js' -> '/usr/local/bin/sass'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/sass/sass.js',
npm ERR! dest: '/usr/local/bin/sass'
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/jonas/.npm/_logs/2022-03-24T06_04_35_362Z-debug.log
(venv) jonas#Air-von-Jonas salaryx %
Also it seems that I can't change permissions of a folder, I can unlock the lock on the bottom right but then once I try to change permission for "wheel" e.g. it refuses as well.
You are having a system permission issue. An easy way to avoid it is to use the sudo command:
sudo npm install -g sass
Otherwise you can visit Resolving EACCES permissions errors when installing packages globally from npm's official doc. There is a guide, and the solution is to either reinstall npm with a node version manager or manually change its default directory.
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
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