I really need some help getting yeoman and grunt set up and running

Hello all,

I am having serious trouble getting yeoman and grunt running on my Ubuntu 14.04 box. The big problem stems from apt-get already having a package called node. Since this whole ecosystem runs on nodejs, it's a huge pain trying to getting packages to install because they want to install to a directory called node, but the nodejs directory in Ubuntu gets installed to nodejs. So, I tried making a symbolic link... (and a bunch of other stuff), and now I think my fs is messed up for all future work with node on my computer (yay!).

Would anyone be able to help me set this up, maybe from the ground up. Like with a fresh install of node? Any help would be appreciated.

I'm going to drop a few commands below. You can ignore them. I'm posting them so I can refer to them later when I'm trying to undo any damage I did.

sudo ln -s /usr/bin/nodejs /usr/bin/node

echo '[[ -s "$HOME/.nvm/nvm.sh" ]] && source "$HOME/.nvm/nvm.sh"' >> ~/.bash_profile

sudo npm set prefix '/home/cotton/.npm' -global
sudo npm get prefix
echo "export PATH=$PATH: $HOME/.npm/bin" >> $HOME/.profile

echo prefix = ~/.node >> ~/.npmrc
echo 'export PATH=$HOME/.node/bin:$PATH' >> ~/.bashrc

So to make node even easier to use on Ubuntu, there's a whole permission debacle to add to the mix:

So to get around the problem of the "node" directory issue, previously mentioned, apt-get has placed a legacy node-js package in their repo. Something to do with having access to the bianary package helps npm install node packages. However, this requires the use of sudo. Now, you're installing to your /usr/local/lib directory, and now, cue the host of permission issues on development machines.

Some how the following "fixes" the problem. You can install a package called node version manager and it lets you install local instances of packages "globally" to your home directory. This workaround also allows you to install true local instances of packages to specific projects.

Still, yeoman has unmet dependencies, doesn't allow me to install generators and scaffold my apps. This is the shit that makes me want to go buy an Apple. This stuff drops in and runs. None of this stupid crap. For me, if I can't correct this in the next 2 hours I'm getting a MacBook Pro.


To run an application's server you can simply run a node command -- node app. However, you have to run nvm install stable for each time you are in a fresh terminal, which then replies that the most current version of node is currently installed, before the command works. Maybe a good place for a bash script to fire that every time I log into the terminal... anyways.

Now, it's telling me that the prefix I used in the first post is corrupting nvm from executing. Here's the exact message:

nvm is not compatible with the npm config "prefix" option: currently set to "/home/cotton/.node"
Run `npm config delete prefix` or `nvm use --delete-prefix v5.0.0` to unset it

Doing this will break my ability to install generators to yeoman. Otherwise when I command yeoman to install a new generator, it will go out download it, but not be able to access it. So, either I can launch my apps or build scaffoldings. I'll go with the server, because the scaffolding hasn't generated one good package.json files or grunt.js files. And grunt still wont' run.

This is really frustrating. Maybe I should just become a Ruby on Rails dev... I'm going sleep on it...

How did you install node?

It's been awhile since I installed it, but I believe I did this:

apt-get install build-essential libssl-dev
curl https://raw.githubusercontent.com/creationix/nvm/v0.25.0/install.sh | bash

That is for node version manager, and then I just use Node install [vesion] to install the version of node I need locally to the project I'm working on.


After deleting and reinstalling grunt I get this error when trying to run a grunt command:

$ grunt
/usr/bin/env: node: No such file or directory

I'm super motivated to get this ecosystem working by the end of the day. Here's the game plan:

I think that my env and $PATH variables are messed up and pointing to the wrong directory. Hopefully completely uninstalling NVM, NPM, and it's modules from everywhere on my computer will not only give me a fresh start, but get ride of symbolic links, and reset env variables.

Starting with the /usr/local/lib - then moving to /usr/local/include - then moving to my home directory for any local, lib, or include directories. Going on to an ap-get remove nodejs and nodejs-legacy command. Lastly, check my /usr/local/bin to remove any node reminiscence from there.

Try to reload nvm, nodejs, npm and yeoman. If this still doesn't work... well it's a wipe and reload to get everything reset back to the start. Back up all my code to github, reinstall Ubuntu, and recreate my OS again. I need a stable OS for the next few weeks to complete a project then...

I'm finding a non-debian based Linux distro so I don't have to deal with the problem with the other node application taking the directory name I need.

I'm going to need a cup of coffee.

Removed all node, nodejs, nvm and npm and all those . versions hidden in my home directory. Additionally, I removed all lines for these programs in my .bashrc file. There were three. One from nvm and two from heroku.

Also ran apt-get remove node and nodejs and nodejs-legacy.

Lastly, I did this... just because it seems to be important:

sudo rm -rf $NVM_DIR ~/.npm ~/.bower

Feel good about that. Unfortunately this didn't clear out the $PATH variables. Now I need figure out how to edit my $PATH so remove all NVM and Heroku.

bash: /home/cotton/.node/bin:/home/cotton/.node/bin:/usr/local/heroku/bin:/usr/local/sbin:/usr/local /bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:

I highly recommend setting up a VM for development so you don't do stuff like mess up your $PATH on accident.

1 Like

No kidding! I probably should have been running VMs for like, everything... lol. Have a VM for development, a vm for hosting, a vm for using the net and have my base OS just for hosting these VMs.

Now, I'm planning on looking into how to back up the home directory, mostly for the settings, so if this ever happens again, I'll just reinstall that.

Anyways, it looks like deleting all that has adjusted my $PATH for me. That's the first nice thing this stupid machine has done for me in like a week.

New $PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games: No such file or directory

Additionally, found in .profile w/i the export PATH = a heroku path and nvm. Removed those. Furthermore, in bash_profile I commented out a line

'[[ -s "$HOME/.nvm/nvm.sh" ]] && source "$HOME/.nvm/nvm.sh"'

Okay --- At this point I think, for all my computer knows: NPM, NVM, and Nodejs have never been installed on it. Like this girl is always telling me: "I'm going take a hot minute and relax." Catch you in a few.

Moving on to the next phase of this go for broke project: reinstalling.

I'm going to assume that I have eradicated all instances of node and it's pesky companions from this computer. Now, I just need to ensure I properly install node. It seems like there are 45 different ways listed online to install node to an Ubuntu machine. Everything from using a sudo install and then changing permissions to about 16 different "proper" ways of installing NVM. All of them more complicated that I'd like, but then again, if it was easy everyone would be doing it (and where's the fun in that?).

I'm thinking NVM is the way to go. However, I should do some research to figure out how this whole ecosystem works on a machine. It appears that you want to install NVM (to / ?) which should install npm to the machine (again to / ?). From here you can use nvm to install local instances of nodejs to each project. I guess the idea is that you can have the freedom to pick which version of node you want (who cares, just make it run).

NPM allows you to install packages other than nodejs to local projects. But, some programs are good to install globally, like bower, or yeoman. Basically any CLI node programs.

I'm still a little in the dark how this all works together still. It's like tiers, I guess. Top tier installation would be sudo. But that's not what I want. You can do a install to a home directory, which should allow directories (or projects in this case) to utilize npm. Global installations would be to the user's home directory, but mock a true sudo installation. The local installations would be things like express or other middleware.

I'm going to look into this for a few minutes.

Tried setting up an Ubuntu VM to do a practice install before going for it on my main OS. Unfortunately, my laptop doesn't have the horsepower to run an Ubuntu VM on my Ubuntu Host. Had to settle for going "LEEEEROY JENKENS!!!" on this one, and charge right in and go for it.

Turns out I successfully cleared everything off. I did an install of NVM following the README on the nvm github page. Next, did a non-sudo global install of bower, yo, grunt-cli and gulp. It installs these in a .nvm directory in my home directory. After installing a practice generator, I ran yo to scaffold a basic webapp.


Really glad this is working. My assumptions about how Node works from the previous post seem to be pretty accurate. Except that nvm and npm are not install to /usr they are installed to home and placed into hidden files. Currently there are no "node" programs outside my home directory.

I'm afraid to close the terminal and try again, but well I'm going for it.

EDIT: To get the cli commands to work in a fresh terminal for yeoman and grunt, just run nvm use 5.0, which is the version installed from nvm and saved into ~/.nvm.

Time to figure out how to back up my home drive and the settings.

Mission accomplished --- now to build some apps.

If you're getting no such file or directory when trying to call it from /usr/bin/env, that means you don't have grunt on your path.