Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to update express to version 4

Tags:

express

I just tried to update my version of express to 4.0.0

I used sudo npm install -g express and I can see the newest version has already been installed on my laptop.

However, when I type express -v, the version is still 2.5.8. How to change it to 4.0.0?

Thank you

like image 496
Heartless_m Avatar asked Feb 13 '23 03:02

Heartless_m


1 Answers

Express has removed the bundled generator from the main project, to update the express generator use this command:

$ sudo npm install -g express-generator

Then when you'll do express -V:

$ 4.0.0

You might get an error like:

Error: Refusing to delete: /usr/bin/express not in /usr/lib/node_modules/express-generator

If you do, just uninstall the v3 express generator like:

$ sudo npm uninstall -g express

Then do the commands above again.


Something else seems wrong with your installation, force the deletion of express v3:

$ sudo rm -rf $(which express)
like image 184
majidarif Avatar answered Feb 16 '23 10:02

majidarif