Gulp install error - node.js

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

Related

node js npm package installation not completed

I try to install node js npm packages, but It start to install and unfortunately freezes. I also try to install angular packages and it doesn't any problem. please help to fix this issue.
node version is 12.13.1;
npm version is 6.12.1;
I tried to install packages this way
npm i html-to-xlsx
here is a result:
another installation result:
Try the following commands then re-run the command:
npm cache clean --force
npm cache verify
And make sure you are in a place with good internet connection. Sometimes this is the issue.
I found way to fix this issue. I add -g before package name
npm install -g html-to-xlsx
Everything looks good
After that I enter this path C:\Users{USERNAME}\AppData\Roaming\npm\node_modules and copy needful module into my working folder

when I try to install by npm it frezzes in this step exactly

i was triyng to install babel and webpack by npm in command line
but when i type npm install it frezzes in this step exactly
: C:\Users\\AppData\Roaming\npm-cache_locks\staging-d144261d8cd07e07.lock
There could be a lot of different causes for your error as there is not a lot of information from you. If you have the time, please try the following:
Uninstall Node.js
Delete the cache folder from C:\Users\YourName\AppData\Roaming
Delete the node/npm file from C:\Users\YourName
Uninstall Git Bash
Install Node.js and Git Bash
After you did all of the steps, please try to npm install again.

NPM Experts! Does NPM need to be installed with every JointsWP Gulp Sass project

I'm using JointsWP (an excellent Foundation 6 port to Wordpress).
I'm using the Sass version and it's working great. However, I seem to have to install npm with every project. Is this nessesary?
Is there a way to install npm globally and link to it from my project? Or have the project find it automatically?
I think you are confused about what the command npm install actually does. npm install installs all the npm dependencies for your project into the node_modules directory. It doesn't actually install npm. To run npm install you have to have Node.js installed (npm is included with node).
So to answer your question, yes it is necessary to run npm install for every project.
Relevant Article: Global vs Local installation
The article above shared by Colin Marshall is great and sums up the answer perfectly.
In general, the rule of thumb is:
If you’re installing something that you want to use in your program,
using require('whatever'), then install it locally, at the root of
your project. If you’re installing something that you want to use in
your shell, on the command line or something, install it globally, so
that its binaries end up in your PATH environment variable.
So to answer your question, is it possible? Yes.
Is it recommended? No.
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
You can install gulp sass globally with the command:
npm install -g gulp-sass

'cmd' - not able to get the `grunt` version

I have installed the grunt using this command : npm install -g grunt-cli after i installed i am trying to fetch the grunt version using this command :
grunt --version - But i am not getting any output. what is the issue here? do i require to set the env variable or something?
please help me.
You would need to install Grunt globally as admin. Grunt docs recommend to use sudo when installing. This would be recommended for any Grunt or Gulp plugins you are installing globally. Run the same command npm install -g grunt-cli in admin command line then try grunt --version once more.
I'd recommend posting a separate question for the grunt processing as that involves much more functionality. A good example on a sample gruntfile can be found at Sample Gruntfile and includes processing js and html files for various tasks.
Let me know if that helps.
Thanks!

NPM appears to do nothing on Linux Mint 15

searched, and did not see this specific problem.
Trying to get a MEAN stack built on my Linux Mint machine, and bumping into a bit of an unusual issue.
Got MongoDB installed, and finally got it running correctly (none of the instructions ANYWHERE mentioned having to create the /data/db/ directory and set permissions, go figure).... it works now.
Got NodeJS installed, and it appears to work correctly.
I had been told (apparently incorrectly) that NPM installs right alongside Node, with:
sudo apt-get install nodejs
but:
$ npm
bash: /usr/bin/npm: No such file or directory
So I go ahead and install NPM separately.
$ sudo apt-get install npm
Seems to work, so far, no errors, and it looks like it is pulling down the NPM package and installing it...
$ nodejs -v
v0.10.21
$ npm -v
$
?? It simply fails to respond without any error... so I try:
$ npm install grunt -g --save-dev
$
Same completely silent failure... in fact, NOTHING I could do gets a response out of NPM.
Looked all over the web, and saw nothing similar anywhere... found out that NPM holds its cache files in ~/.npm and noticed that this folder didn't exist (kinda like the mongo issue above), so I created it, and set permissions to 7777... still nothing.
Purged and re-installed both node and npm, tried installing them both together and separately (yes, desperation)... still no love.
WTF am I doing wrong?
I would love, eventually, to have a nice development environment setup, hopefully with Cloud9 as a local IDE.... but already pulling my hair out.
=========================================================================================
OK, after a few more headaches, this is up and built now... thank you all.
Would love to mark both as answers, but it won't let me.
npm does come with node. Where is apt-get pulling it from? I install the Mac OS X packages on my Mac for development and npm does in fact come with it. I compile from source on my CentOS server and npm comes with it.
Your package provider may be providing them separately as a (in)convenience to you.
As for why your npm command does not work after installation, I can't say for sure, but I am suspicious of your use of --save-dev and -g together.
-g means to install globally, which means 2 things:
It will be installed outside of your npm package's structure into a system location like /usr/bin or /usr/local/bin
It requires root access to install. Did you use sudo to run it with root access?
Both of those requirements conflict with --save-dev which records the package as a dependency in your package.json file so that future npm install commands will install that package within the project space.
That said, I happen to know a lot about grunt. It has 2 parts, a globally installed tool and the package-specific tool. The correct way to install it is:
$ [sudo] npm install -g grunt-cli
$ npm install grunt --save-dev
This will install the grunt-cli package into a system location guaranteed to be in the $PATH, which turns around and looks for a package-specific grunt installed which is not system-wide.
When installing nodejs with npm, this one-liner worked for me.
sudo apt-get install nodejs nodejs-dev npm
I don't believe npm comes with the nodejs installation in the apt repo. Try to install npm separately using the following tutorial http://www.giantflyingsaucer.com/blog/?p=1688 'To install NPM ....'
====== Edit ====
node and npm IS separate. Follow the official wiki and everything should be fine

Resources