You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing a fresh install on macOS 11.0.1 (Big Sur), a permissions error is encountered writing to /usr/local/lib/node_modules (which is owned by root).
Global npm dependencies
If you need to install global npm dependencies, it is recommended to place those dependencies in the non-root user directory. To achieve this, add the following line to your Dockerfile
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$PATH:/home/node/.npm-global/bin # optionally if you want to run npm global bin without specifying path
% npm install -g git+https://git@github.com/imarc/ops
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! 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/kyle/.npm/_logs/2020-11-17T02_42_43_711Z-debug.log
The text was updated successfully, but these errors were encountered:
Change the ownership of the /usr/local/lib/node_modules directory.
sudo chown -R $USER /usr/local/lib/node_modules
OR
Change the location for global node scripts:
# make a directory
mkdir $HOME/.npm-global
# then in your .bashrc, .zshrc, or other
NPM_CONFIG_PREFIX=$HOME/.npm-global
# and also make sure the bin dir is in your path
PATH=$PATH:$HOME/.npm-global/bin
When doing a fresh install on macOS 11.0.1 (Big Sur), a permissions error is encountered writing to /usr/local/lib/node_modules (which is owned by root).
I found this note but am unsure of how to find or modify the Dockerfile:
https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#global-npm-dependencies
The text was updated successfully, but these errors were encountered: