Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 11589  / 3 Years ago, wed, october 27, 2021, 8:50:33

Using Ubuntu 13.10



I am trying to install yeoman using sudo npm install -g yo but it doesn't seem to work globally both npm and nodejs are installed, however, I am not sure that they are installed correctly for use globally. I cannot use npm i have to use sudo npm



To install node js I used



    $ sudo apt-get install python-software-properties
$ sudo apt-add-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs


When I use sudo npm install -g yo the output I get is



    /usr/bin/yo -> /usr/lib/node_modules/yo/cli.js

> [email protected] postinstall /usr/lib/node_modules/yo
> node ./scripts/doctor

[Yeoman Doctor] Everything looks alright!

[email protected] /usr/lib/node_modules/yo
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], supports- [email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], word-
[email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected],

[email protected])
├── [email protected] ([email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], file-
[email protected], [email protected], [email protected], [email protected], gruntfile-
[email protected], [email protected])


So it appears that yeoman is installed correctly but that it isn't working - when I type yo nothing happens... Do I need to put yo in my $PATH? I'm not really sure how to do that.. Additionally, how do I configure npm so I don't have to use sudo npm?


More From » 13.10

 Answers
0

It's worth noting that Ubuntu 13.10 is no longer officially supported, but that shouldn't make much of a difference for these instructions.



npm without sudo



First things first, let's get permissions sorted out. Most of the Node.js installation guides for Ubuntu instruct you to install Node.js from either the official repositories or from the chris-lea PPA. Either way, you'll end up installing Node.js and NPM using sudo, which leads to a permissions mess on development machines.



There's a question on StackOverflow about how to "fix" these permissions, although in most cases, you'll have to make your user the owner of /usr/local/lib/node_modules, which is super sketchy.



Instead, I think the best answer by far is to install Node.js using NVM. In addition to letting you run multiple versions of Node.js on the same computer, this option also keeps everything in your home folder, so your user owns NPM, and you don't have to mess around with sudo npm.



Using Yo



Once your permissions are sorted out, all of the steps you took to install and run Yeoman (npm install -g yo) should work just fine.



You will have to run nvm use v0.10 each time you start a new terminal session, however. You can get around this by adding a script to your .bashrc that will automatically run this for you at the beginning of each session,


[#23791] Friday, October 29, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
finatch

Total Points: 49
Total Questions: 106
Total Answers: 94

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
;