npm install from package.json, the dependancy -v yields command not found - node.js

Reinstalled node/npm from scratch and after npm install I can see the node_modules folder with all of the content from package.json. Checking gulp -v gives command not found in the command line on a mac. If I install gulp globally, gulp -v yields the version.
Is there a way of not installing all dependancies globally to use?

Generally gulp is a package which is used to run some task. These task might need to have administrator privileges. So it is better to install it globally using "npm install -g gulp" command. Here -g means "install it globally".
npm install installs the package locally.

Related

Install packages locally with npm

I am new with Node and npm, and when I try to install packages locally, all of the dependencies for that specific package gets installed in the main nodule_modules folder.
It looks like this
LOCALLY
And if I install them globally it looks like this
GLOBALLY
I think I should mention the fact that the folder where I try to install locally is on Desktop.
If you need to install specific dependancies for a project you are working on then do it locally:
npm install <packagename>
If you need something that you can run from the commandline such as grunt or phantomjs (etc..) then install it globally:
npm install -g <packagename>

Gulp install globally

I need install gulp. I used this command: npm install gulp gulp-plumber gulp-sass gulp-autoprefixer gulp-concat gulp-uglify gulp-notify
Unfortunelly in my project It was created node_modules directory. How do I do this? I don't have to add files in any project. I would like to use only command "gulp watch".
add -g for global installing
$ npm install -g gulp
OR
$ sudo npm install -g gulp
To install a npm package globally on a machine, use one of
npm i -g <packages>
npm install --global <packages>
However, this doesn't let anybody else know about this dependency. Consider instead adding node_modules/ to your .gitignore file (or the ignore of whatever VCS you are using), then install with
npm i --save-dev <packages>
The --save-dev here means that it knows that this dependency is only for development and not required in deployment. So if you use a script to deploy which installs the npm dependencies, you can have it ignore these packages
Add gulp in your package.json and run npm intall from your project directory.

NPM Install is not installing dependencies

I'm attempting to install the Ushahidi V3 Client. I've been following the install process up until when I need to build the project from the source repo using npm and gulp - both of which I've had zero experience with. Whenever I run sudo npm install in the project directory, the process runs without complaints. However, when I run npm ls to verify that dependencies have been downloaded, I get a bunch of dependencies listed out as being missing.
How do I get npm to resolve all of these dependencies?
System Details
OS Ubuntu 14.04 (Trusty)
Node JS v0.12.9
NPM v3.5.1
What I've tried
Removing node_modules folder and re-running sudo npm install as referenced in this SO answer for a similar question: npm Gulp dependencies missing, even after running npm install
Uninstalling and reinstalling node and npm
#Strainy, as your research :D
It was a combination of running as sudo and not having the build-essentials.
That's why you should not use sudo npm
Follow these steps:
try npm uninstall. and then try npm install.
Also If it still doesn't work.
Try:
npm install -g npm-install-missing
or
npm-install-missing
For further reading, click here.

Grunt is not recognised : windows7 64-bit

I have installed npm and installed grunt, but when i run grunt, it says 'grunt' is not recognized as an internal or external command.
I done the below steps in command prompt
npm install
npm install -g grunt-cli
PATH variable and grunt folder are available but still i am not able to run grunt.
Please provide me a solution for this
You have only installed the command line interface.
Use npm install -g grunt to install the actual program.

installing grunt locally as under privileged user

I'm using node/grunt for deploying to a shared hosting server.
I have node installed in $HOME/opt/node
I don't know where npm install -g grunt is going to install it to, or how to tell npm to install global files to $HOME/some/path.
I ran npm install grunt -g and it seemed to work, but I cannot find the grunt binary anywhere.
If you want the grunt command in your server's shell, you'll need to install the Grunt CLI.
npm install grunt-cli -g
Global modules are located here:
/usr/local/lib/node_modules

Resources