Setting Up Node & NPM - node.js

I have installed MEAN IO a few times. Everytime I get it installed I can usually get one project going and then things just stop working. For example I have one project going. But then when I go to create a new project now it says commands are not found
gulp
mean init myApp
bower
So I installed with the installer at https://nodejs.org/en/
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
I have node_modules at
usr/local/lib/node_modules
But I also have packages at
/usr/local/bin/
Either way I cant get these commands to run... Any ideas how I can get things setup and solid?

Try installing mean-cli, bower and gulp globally, like so:
npm install -g mean-cli bower gulp

Related

Gulp install error

So I've been trying to install gulp. I've followed the documentation on its official git page and I've gone though different threats here on SO.
So far i've used the commands: npm install --global gulp-cli and npm install --save-dev gulp
error I keep getting
Check whether your NODE_HOME is proper. On the contrary you can just provide the fully qualified path as the initial gulp command then the task name. Try that too if that works.
Try using:
npm install -g gulp
This has always worked for me in the past.
You might also want to check that you have nodejs installed. To check this, use:
node -v
If you don't, you can download it from here

Error installing Gulp and Bower

I am pretty new to using terminal and installing gulp, but I am running through a few errors. Errors keep popping up and I am not sure why. My goal for right now is to npm install -g gulp and after that npm install -g bower so I get start using Sega Wordpress Started Theme, but not sure if any old files are interfering. Maybe a clean out and reinstall would work? Error is below. Thanks!
npm install -g <package> installs globally, so you need to run with sudo in order to be able to write to the correct destination folders.

Where to install gulp?

I'm trying to leverage from Elixer so I started to get up and running. I've installed Node and Npm. Later I also installed Gulp using sudo npm install gulp -g. But this installed Gulp in my project directory, resulting in a massive file transfer from my local host to the webserver. Is it necessary to install Gulp inside the project directory? Or is there a better way to install it somewhere else and use it for any project needed?
Sorry if this is a total beginners question but I can't seem to find an answer online. Thanks.
There is only few steps to start use it.
Install globally $ npm install --global gulp
Install directly to your project root dir $ npm install --save-dev gulp
Create gulpfile.js in root dir
Then in your new gulpfile do the follow:
var gulp = require('gulp');
gulp.task('default', function() {
// place code for your default task here
});
and after that just type gulp command in terminal to execute default task
here is documentation to help you started with gulp docs and here you can find packages to use it npmjs.com
Tip: if you on OSX use sudo to install npm/jspm/gulp etc
sudo npm install gulp -g shouldn't be installing gulp in your project directory. However, Gulp does always need to be installed locally in the project folder in order for it to work. Otherwise, you will get an error when trying to run Gulp. The -g global installion of Gulp is only needed for linking the shell to the binary $ gulp; it will dispatch to the local gulp program as soon as it is called.
Gulp, bower, ... are dependencies.
The command npm install ... will download the module to the directory named node_modules. They need to be (litterally) a part of your project. Think of it as a pure JS library (as it actually is).

I'm cloning a repo with Yeoman, what configuration do I need on my computer?

I have cloned a repo that has Yeoman installed.
I installed node, as well as Yeoman npm i -g yo. When I run grunt I get an error stating:
Error: Cannot find module 'load-grunt-tasks'
Warning: Task "default" not found. Use --force to continue.
What else do I need to do to be able to run this repo successfully?
The first time, you have to run npm install.
This will install all the needed dependencies as described in the package.json
Subsequently, if anyone add a new dependency into this file, you will need to run npm install or npm update again.
Actually besides npm, you should also download bower dependencies.
So it's 2-step:
npm install
bower install
If you don't invoke bower application may launch, but later you may encounter problems such as the lack of libraries.

grunt init:node not working

I'm trying to do an intro grunt tutorial. I've installed git, node.js, and grunt globally (or at least I thought I did using: npm install -g grunt (which installs). I then made a quick directory and entered it (mkdir demo, cd demo), but when I type:
> grunt init:node
at the prompt I get the following:
grunt-cli: The grunt command line interface (v0.1.11)
Fatal error: unable to find local grunt
If you're seeing this message, either a Gruntfile wasn't found or hasn't been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
Which I've looked at and it says to do what I'm doing and what the tutorial mentions??? Any ideas what I've done wrong? Node.js and Git have been working fine so I can only assume it is grunt or the install that has failed.
Thanks
with grunt you need two elements. a global grunt-cli as you have installed using npm install -g grunt-cli and also a local (to the project) copy of grunt itself. so in the folder of your project install this with npm install grunt --saveDev this will install a local grunt and also add it to your devDependencies in your package.json file. you will also need a Gruntfile.js in the project folder. This is a great write-up http://www.integralist.co.uk/Grunt-Boilerplate.html

Resources