When I want to install npm with the command npm install -g sass
,
I get the following message: Error: EROFS: read-only file system, mkdir '/user
'
Cannot install sass I tried to change the default directory to install my packages.
Here are the manipulations I did to create the new one default directory.
I created a "npm-global" directory with mkdir npm-global
.
Then I set this directory as a prefix with the command npm config set prefix /Users/your_username/npm-global
.
To execute the commands of the installed packages, I added this directory to the directory list of our $PATH variable.
I switched to vi ~/.profile
. In the profile file, I added the export line PATH=/USERS/myuser/npm-global/bin:$PATH
.
I refreshed with source ~/.profile
.
Is it possible to reset npm by default and thus no longer have this problem?
Thank you for your help.
question from:
https://stackoverflow.com/questions/65887587/npm-install-g-sass-mac-os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…