1

I had install node and npm in my ubuntu 12.04.

I am following this for installation that : https://gist.github.com/isaacs/579814 (used the top one) worked successfully

and when I am install grunt in my terminal at home directory path :

npm install -g grunt-cli

and here the results : http://pastebin.com/R3zP55Z2

at seen that had many created nested folder : "/home/antoni/[sudo] password for antoni:"

I didn't know where my faults.

can someone tell me.

thanks a million.

antoniputra
  • 4,251
  • 6
  • 26
  • 31

2 Answers2

1

It looks like you don't have permissions to write to that directory. I would firstly check if you have permissions to write the directory:

ls -la /home/antoni/local

If you do have the right permission you should see something like drwxr-xr-x and your username. The key being the w character in the third column. If for some reason the directory doesn't have drwxr-xr-x then chmod it to add write permissions:

chmod -R 755 /home/antoni/local

Or if the current owner is wrong then try running:

chown -R $USER /home/antoni/local

You may need to use sudo for these. After that check you can write to it by running:

touch /home/antoni/local/test.txt

If that fails then there is still a problem with the permissions (perhaps previous commands failed). If that works and it still doesn't install then have a look at where npm is trying to write to:

npm bin -g
npm root -g

These 2 directories are where npm will install the components of grunt-cli. It's worth checking to make sure these 2 directories are writable by you to also.

MattGoldspink
  • 351
  • 2
  • 5
  • 1
    Did you read the link he posted? "Use one of these techniques to install node and npm without having to sudo." – badsyntax Feb 12 '14 at 16:55
  • 1
    @badsyntax Yes I did see that, there's a comment right after what you've pasted which states: "Note: npm >=0.3 is *safer* when using sudo." In addition line 15 of the output says: "5 error Please try running this command again as root/Administrator." which I would interpret as meaning the user needs to elevate to sudo to install it. – MattGoldspink Feb 12 '14 at 17:01
  • @MattGoldspink : as explained with badsyntax. I can run npm without sudo. but by the way, you of all successfully install gruntjs ? – antoniputra Feb 12 '14 at 17:06
  • @MattGoldspink you'd get that error when file permissions are not set correctly. running as super user is not always the answer to everything. in any case, it looks like kiddcode is asking how to do this without using sudo. – badsyntax Feb 12 '14 at 17:08
  • @MattGoldspink if I run sudo npm, that will be error. I thought that technique installation automatically include sudo. and that error in pastebin because I run npm install -g grunt-cli two times. my question is : that is normal, npm created many nested folder like that ? – antoniputra Feb 12 '14 at 17:09
  • @badsyntax Agreed - sudo is not the answer to everything, however based on what the question said so far it seemed like the solution to me. – MattGoldspink Feb 12 '14 at 17:31
1

solved. I do like at this answer : npm global path prefix

I am wrong in my prefix npm. before I set in home/ dir. that make npm created many nested folder. (I still dunno why ?)

and then, I fix that problem to do something like this in terminal :

sudo chown $USER:$USER /usr/local
npm config set prefix /usr/local

Horray !! :D

Community
  • 1
  • 1
antoniputra
  • 4,251
  • 6
  • 26
  • 31