Yeoman is a really cool scaffolding tool that comes with lots of pre-built generators for a range of applications. I use it for initiating angularJS applications using yo's 'official' angularJS generator.
In Ubuntu 14.04 (actually starting from 13.10) versions 0.10.x of nodejs are present in the official repositories. So in order to install nodejs package manager just type:
sudo apt-get install npm nodejs-legacy
npm alone is not sufficient to install Yeoman, since the latter depends on 'node' legacy binary during installation, hence nodejs-legacy package is also required.
sudo npm set prefix '$HOME/<user-space-local-npm-directory>' --global
i.e.
sudo npm set prefix '/home/andy/dev/npm' --global
Verify that setting has been set using; defaults to /usr/lib
sudo npm get prefix
Update your $PATH variable to include the location npm installs binaries,
echo "export PATH=$PATH:$HOME/dev/npm/bin" >> $HOME/.profile
and restart your terminal session.
npm install -g yo
as mentioned in the official site.
npm install -g generator-angular
Generate angularJS application
yo angular
Invoke grunt to build the application grunt serve (or python -m SimpleHTTPServer) to preview the application.
In Ubuntu 14.04 (actually starting from 13.10) versions 0.10.x of nodejs are present in the official repositories. So in order to install nodejs package manager just type:
sudo apt-get install npm nodejs-legacy
npm alone is not sufficient to install Yeoman, since the latter depends on 'node' legacy binary during installation, hence nodejs-legacy package is also required.
Install global npm packages as a regular user.
npm installs packages under a 'prefix' configuration variable, which defaults to /usr/lib in Ubuntu 14.04. In order to avoid using sudo for every npm-install command, you may configure 'prefix' variable to point into a user local directory.sudo npm set prefix '$HOME/<user-space-local-npm-directory>' --global
i.e.
sudo npm set prefix '/home/andy/dev/npm' --global
Verify that setting has been set using; defaults to /usr/lib
sudo npm get prefix
Update your $PATH variable to include the location npm installs binaries,
echo "export PATH=$PATH:$HOME/dev/npm/bin" >> $HOME/.profile
and restart your terminal session.
Install Yeoman
Installing yeoman is dead simple; just invokenpm install -g yo
as mentioned in the official site.
AngularJS scaffolding
Install angularJS generatornpm install -g generator-angular
Generate angularJS application
yo angular
Invoke grunt to build the application grunt serve (or python -m SimpleHTTPServer) to preview the application.
Great that you have mentioned clearly about the subject which I have missed at online Angularjs training. Thanks for the clear cut presentation of the information.
ReplyDeleteThanks for sharing this valuable information to our vision. You have posted
ReplyDeletea trust worthy blog keep sharing.
Angularjs Training In Hyderabad
In order to get yo to install I had to do it as root .. now when I am a regular user and do yo it can't find yo in my path?
ReplyDelete