-bash: express: command not found - node.js

After numerous attempts at installing Express, my only output has been as stated in the title. Your help would be much appreciated. Below is a list of commands I've tried.
With my working directory being the directory I want the app to be in,
Trying 'sudo npm install express', I get:
sudo npm install express
Followed by 'sudo npm install -g express-generator, I get:
sudo npm install -g express-generator
Now, running 'express', I get:
"-bash: express: command not found"
I have read through the top answers of 4 to 5 posts to no avail. Please help me!

Your question is not readable. I try to answer: you are on osx, I advice you to install nvm. You can make a google search. Then you can install node.js by: nvm install node and finally you can type nvm use node. This solves your sudo problem and you can install express-generator and other packages without a sudo.

Related

express: command not found after installing express-generator#4.15.5

My first post here, after reading hours and solving many problems for me:)
Im running macbook OS X El Captain.
I installed Node v8.9.4
I run "sudo npm install -g express-generator" I get the following feedback:
myname-MacBook-Air:todo myname$ sudo npm install -g express-generator
/Users/myname/.npm-global/bin/express -> /Users/myname/.npm-global/lib/node_modules/express-generator/bin/express-cli.js
+ express-generator#4.15.5
updated 1 package in 1.052s
When I now try to run "express newproject", I get the following error:
myname-MacBook-Air:todo myname$ express newproject
-bash: express: command not found
I have a feeling I might have some paths set up the wrong way. I appreciate help!
The executable is installed in
/usr/local/share/npm/bin/
Try add that directory to your path and it will solve the problem.
export PATH=/usr/local/share/npm/bin:$PATH
Install Express Globally
1] npm install express -g
and also install express-generator locally, If it is not working then try to do that by globally
2] npm install express-generator or npm install express-generator -g

Problems installing Grunt.js

Been at this for a couple nights now, trying to get Grunt.js to work on my mac.
I've installed Homebrew, Node.js, npm... but when I try to install grunt-cli I get an error.
Im running in my terminal: npm install -g grunt-cli
The error is -bash: npm: command not found
I've been searching forever trying to figure out what this means. I've deleted all instances of node I could find and re-installed.
When I run npm -v I get -bash: npm: command not found
What is going on? I need help.
Thank you.
UPDATE: Turns out I had to reinstall Node and make sure my file paths were correct again.

express command is not working in ubuntu 14.04 LTS terminal

First thing I want to clear here that may be this question is duplicate.But I read all the question related on this topic in stack overflow but not got the solution.
Please Help me. I just install Nodejs version in my Laptop on Ubuntu OS.For ensure that nodejs is install on my laptop, Using node -v I found the version of Node js which is 0.12.2
and same for npm I follow same steps and it works for me.But when i install ' express 4 version'. I use which node command and it is working and show the path is /usr/bin/node and same for npm is /usr/bin/npm.
but when i check for express it is not working for me. I have number of time install express-generator using 'sudo npm install -g express-generator' and it install the files but when I use express my_app command it print The program 'express' is currently not installed. You can install it by typing:
sudo apt-get install node-express
Run:
npm install -g express
In most cases you do not need sudo.

install express with npm

I recently installed nodejs version 0.10.26 on ubuntu 64 bit. node -v and npm -v commands run fine and I can see the correct versions. When I do a $ sudo npm install -g express
the installation goes fine. But when I try to create a project with express as $ express myProject I get an error saying
The program 'express' is currently not installed. You can install it
by typing: sudo apt-get install node-express
Do I have to include some path in $PATH in order to run express? Please help.
With Express 4, the application generator was removed and is now available as 'express-generator.' So you need to npm install -g express-generator instead.
Enter the command in your terminal
npm install --save express

Can't get Gulp to run: cannot find module 'gulp-util'

On Windows 7, I've installed gulp as explained here: http://markgoodyear.com/2014/01/getting-started-with-gulp/:
npm install gulp -g
In my app folder: npm install gulp --save-dev
I create a gulpfile.js file.
But then, when I try to run gulp, I get this error message:
module.js:340
throw err;
^
Error: cannot file module 'gulp-util'
at Function.Module._resolveFilename (module.js:338:15)
etc.
But gulp-util is present (in the local app folder) in:
node_modules
gulp
node_modules
gulp-util
Any idea what may be the cause?
UPDATE
From later versions, there is no need to manually install gulp-util.
Check the new getting started page.
If you still hit this problem try reinstalling your project's local packages:
rm -rf node_modules/
npm install
OUTDATED ANSWER
You also need to install gulp-util:
npm install gulp-util --save-dev
From gulp docs- getting started (3.5):
Install gulp and gulp-util in your project devDependencies
If you have a package.json, you can install all the current project dependencies using:
npm install
Any answer didn't help in my case.
What eventually helped was removing bower and gulp (I use both of them in my project):
npm remove -g bower
npm remove -g gulp
After that I installed them again:
npm install -g bower
npm install -g gulp
Now it works just fine.
Linux Ubuntu 18:04 user here.
I tried all the solutions on this board to date. Even though I read above in the accepted answer that "From later versions, there is no need to manually install gulp-util.", it was the thing that worked for me. (...maybe bc I'm on Ubuntu? I don't know. )
To recap, I kept getting the "cannot find module 'gulp-util'" error when just checking to see if gulp was installed by running:
gulp --version
...again, the 'gulp-util' error kept appearing...
So, I followed the npm install [package name] advice listed above, but ended up getting several other packages that needed to be installed as well. And one had a issue of already existing, and i wasn't sure how to replace it. ...I will put all the packages/install commands that I had to use here, just as reference in case someone else experiences this problem:
sudo npm install -g gulp-util
(then I got an error for 'pretty-hrtime' so I added that, and then the others as Error: Cannot find module ___ kept popping up after each gulp --version check. ...so I just kept installing each one.)
sudo npm install -g pretty-hrtime
sudo npm install -g chalk
sudo npm install -g semver --force
(without --force, on my system I got an error: "EEXIST: file already exists, symlink". --force is not recommended, but idk any other way. )
sudo npm install -g archy
sudo npm install -g liftoff
sudo npm install -g tildify
sudo npm install -g interpret
sudo npm install -g v8flags
sudo npm install -g minimist
And now gulp --version is finally showing:
CLI version 3.9.1
Local version 3.9.1
Try to install the missing module.
npm install 'module-name'
Same issue here and whatever I tried after searching around, did not work. Until I saw a remark somewhere about global or local installs. Looking in:
C:\Users\YourName\AppData\Roaming\npm\gulp
I indeed found an outdated version. So I reinstalled gulp with:
npm install gulp --global
That magically solved my problem.
You should install these as devDependencies:
- gulp-util
- gulp-load-plugins
Then, you can use them either this way:
var plugins = require('gulp-load-plugins')();
Use gulp-util as : plugins.util()
or this:
var util = require('gulp-util')
This will solve all gulp problem
sudo npm install gulp && sudo npm install --save del && sudo gulp build
None of the other answers listed here-- at least by themselves-- solved this for me.
I'm using Ubuntu 20.04 on Windows Linux Subsystem (WSL2). After reinstalling gulp globally with npm install gulp -g seemingly I needed to log out of my WSL instance and log back in again (closing and reopening my CLI was enough).
Hopefully this helps someone else.
I'm using Linux Mint 20.3. Had this error. Nothing helped.
gulp --version
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module 'gulp-cli'
Found a solution after 2 hours of trying different things.
"sudo" ! simple as that.
sudo gulp --version
CLI version: 2.3.0
Local version: 3.9.1
Some gulp commands should be used with sudo to avoid errors
In most cases, deleting all the node packages and then installing them again, solve the problem.
But In my case, the node_modules folder has no write permission.
I had the same issue, although the module that it was downloading was different.
The only resolution to the problem is run the below command again:
npm install

Resources