I am trying to install monaca with this command.
npm install -g monaca
But right after getting these errors:
it is very simple you can use
sudo npm install -g monaca
or
su -
then
npm install -g monaca
explenation
su -
makes you as root ,who have permission to read , write and delete in all users click here for the screen shot showing the error and the solution in the update of npm
this is for ubuntu i don't know is it work for other os
Well, I used --save-dev
and installed it not globally or using -g
, the main problem occurs while you want it to write on default node_modules
folder.
It solved my problem after 4 hours of checking multiple issues.
I even suggest you to use the npm init
and make a package.json
for a better dependency checking and then run npm
install afterward. this video helps you for this https://www.youtube.com/watch?v=rTsz09zRuTU
add following lines to ~/.bashrc after installing npm:
npm set prefix ~/.npm
PATH="$HOME/.npm/bin:$PATH"
PATH="./node_modules/.bin:$PATH"
Execute following line after changes:
source ~/.bashrc
and as mentioned by @contemplator avoid using sudo
Note: It is highly recommended to avoid using sudo
with npm!
Using sudo is not recommended. It may give you permission issue later. While the above works, use these instructions to fix your issue permanently.
An inadvisable way to fix the issue would be to use sudo:
sudo npm install -g monaca
However it would be better to find a way around this without using sudo.
npm install -g less does not work