0

Hello everyone I am running into a problem that I can't seem to get my head around. I am setting up a server to deploy an app. The server is Ubuntu 16.04 LTS (Xenial Xerus) PVHVM. I have installed NVM and have installed all of my npm packages but for some reason I am unable to install yeoman. I have tried various solutions and none seem to work. Any ideas and or suggestions would be greatly appreciated.

When I try to install yeoman with the following I get permission denied

npm install -g yo

Error:

/root/.nvm/versions/node/v8.1.4/bin/yo -> /root/.nvm/versions/node/v8.1.4/lib/node_modules/yo/lib/cli.js /root/.nvm/versions/node/v8.1.4/bin/yo-complete -> /root/.nvm/versions/node/v8.1.4/lib/node_modules/yo/lib/completion/index.js

yo@2.0.0 postinstall /root/.nvm/versions/node/v8.1.4/lib/node_modules/yo yodoctor sh: 1: yodoctor: Permission denied npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! yo@2.0.0 postinstall: yodoctor npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the yo@2.0.0 postinstall script.

Solutions researched/attempted:

npm throws error without sudo

https://github.com/keystonejs/keystone/issues/1566

Install NPM into home directory with distribution nodejs package (Ubuntu)

Galactic Ranger
  • 851
  • 3
  • 14
  • 30
  • Try with sudo... – EvgenyKolyakov Jul 16 '17 at 08:24
  • I tried sudo and I get the same error – Galactic Ranger Jul 16 '17 at 08:41
  • I think you made a mess... how come that without sudo your home is /root and the error is complaining about permissions... you are not doing this with the user to whom npm belongs.. – EvgenyKolyakov Jul 16 '17 at 08:44
  • What is the output for `which npm` – EvgenyKolyakov Jul 16 '17 at 08:44
  • This is my first time using ubunto. I try really hard not to make a mess. Let me explain my steps and you can tell me if I did something wrong. 1) installed ubuntu 2) sudo apt-get update 3) sudo apt-get install build-essential libssl-dev 4) curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash 5) Relaunced terminal 6) npm install -g yo – Galactic Ranger Jul 16 '17 at 08:59
  • To answer your question about root, I used ssh root@myipaddress from my terminal. Should I not be using root to ssh – Galactic Ranger Jul 16 '17 at 09:02
  • I enter as root only in extreme situations... usually it's preferable to create a user and give it all it needs - least privileged approach - much safer. – EvgenyKolyakov Jul 16 '17 at 09:55

2 Answers2

0

try uninstall nvm then remove ~/.nvm folder and install it from script

do

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

add that line in ~/.bashrc

export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

arkan
  • 1
0

Based on the feedback I received I created a new user, gave that user sudo, installed nvm, installed nvm install stable and was then able to install yeoman without any errors

Galactic Ranger
  • 851
  • 3
  • 14
  • 30