You are not logged in.
I have installed node tried to install express under default settings
So, according to https://wiki.archlinux.org/index.php/Node.js_ , I followed the step:
$ npm config edit
I uncommented prefix and set:
prefix=/home/gleiton/.node_modules
and added ~/.node_modules/bin to the $PATH
But after installing express
$npm install -g express
and opening a new terminal:
[gleiton@gleiton ~]$ express -h
bash: express: comando não encontrado
[gleiton@gleiton ~]$ whereis express
express:
[gleiton@gleiton ~]$ ls .node_modules/
etc lib
[gleiton@gleiton ~]$ npm list --depth=0
/home/gleiton
└── express@4.14.0
As we can see, there is no bin directory, neither in ~/.node_modules nor in /usr/lib/node_modules.
And, no executable known as "express"
Last edited by gleiton (2016-11-29 13:34:18)
Offline
Are you sure that setting the prefix took effect? Browsing through the wiki page you linked to, I suggest you try
npm -g install express --prefix /home/gleiton/.node_modules
and report back on whether that was successful.
Offline
@robg thanks for the tip. I chose setting prefix by npm config edit, and I've seen files were copied there.
Anyway I executed your command line, logged in again but nothing.
Files related to express are installed, but no command "express", and no "bin" directory.
$ find ~/.node_modules/ -type f -name express
(nothing shown)
Offline
I checked it out myself and you are right. However the solution to your problem is not far: If you check ~/.node_modules/lib/node_modules/express and have a look at the content of the Readme.md file in that folder you'll notice that the command line utility for express is apparently in a separate package called "express-generator". In fact executing
npm -g install express-generator --prefix ~/.node_modules
did the trick for me.
Offline
Great! That worked for me too. Now there's something in bin/ path.
$ find ~/.node_modules/ -type f -name express
/home/gleiton/.node_modules/lib/node_modules/express-generator/bin/express
$ find ~/.node_modules/ -type l -name express
/home/gleiton/.node_modules/bin/express
Maybe my book is outdated, but the documentation is clear. Reading the old Readme is always a good idea.
Thanks a lot @robg, I think I can put a "Solved" on this issue, with "perfect" rsrs.
Offline