-2

I have installed nodejs 8.11.3 on RHEL 7.5. Next step is to install the connect web server by running the command from the nodejs installation directory. npm install connect

However, my problem I cannot find the nodejs installation directory in RHEL OS.

As per some suggestion on the internet I ran rpm -ql nodejs-8.11.3, but did not establish the nodejs installation directory.

Please advise how to install connect web server to work with nodejs in RHEL.

Thanks JJ

aynber
  • 22,380
  • 8
  • 50
  • 63

1 Answers1

0

That isn't how Node.js packages work.

You need to run npm install connect in the directory where you want to install the module. i.e. in your project directory.

(And you should probably run it with --save to update your package.json file with the dependency you just added).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • I want to know where the node.js installation directory is. The instructions/documentation says...…..Installing the Web Server A simple web server will suffice for development, and create one using a Node.js module called Connect. From within the Node.js installation directory, run the following command: npm install connect NPM is the node package installer, and it will pull down the files required for the Connect module. Next, create a new file called server.js (still within the Node.js installation folder) and set the contents so they match those shown – user10118326 Jul 23 '18 at 14:19
  • @user10118326 — The instructions are wrong. You absolutely should not run that command in the node.js installation directory. You should run it in the directory you are creating your project with. – Quentin Jul 23 '18 at 14:41
  • There isn't really just a thing as the "node.js installation directory" anyway. Linux packages install files in a number of different places, the node executable itself is likely in `/usr/bin` along with lots of other programs. – Quentin Jul 23 '18 at 14:42
  • when I run in it any Linux folder, it gives error no such file package.json – user10118326 Jul 23 '18 at 14:47
  • You should create your project before you start adding dependancies to it. https://docs.npmjs.com/getting-started/creating-node-modules – Quentin Jul 23 '18 at 14:48