For this module the default profile is named `default. A profile is group, usually a subset, of the packages in a module. Or even, shorter using sudo yum install above commands would have installed the nodejs with the default profile. You could have simply typed the following to install the default nodejs module. $ sudo yum module list # list all available modules in appstreamįrom the output you can see that Node.js 10 is the default module to install, note the ``. The first step is to see what modules are available the Applications Streams (appstream) repo: You can use a browser such as Firefox, to connect to the Node.js web server using the URL ` Alternatively, you can use `curl` in a different window/terminal tab: Res.end('Hello, Red Hat Developer World from ' +Ĭonsole.log('Processed request for '+ req.url) Ĭonsole.log('Server running at + laddr + ':' + port + '/') Using your preferred text editor, create a file named hello-http.js with the following content: The next step is to try a slightly larger Node.js example that implements a tiny web server. Now because the program starts with `#!/usr/bin/node` you can run it directly: Hello, Red Hat Developer World from Node v10.11.0 Using a text editor such as vi, nano, or geditcreate a file named hello.js with the following content:Ĭonsole.log("Hello, Red Hat Developer World from Node " + process.version) Let’s create a Node.js program that can be run from the command line. Check the version and the path:Īlternatively If you wanted to install only a minimal set of Node.js packages, the command is:įor an explanation of the above commands, see Working with AppStreams below. For developers, using the development profile installs the libraries that enable you to build dynamically loadable modules. The default is to install a common set of runtime packages. There are several profiles available for the Node.js package. Nodejs 10 common, development, minimal, s2i Javascript runtime $ sudo yum module install nodejs/developmentįirst, see what Node.js package are available as part of the Application Stream Repository: Install latest Node.js with development libraries
0 Comments
Leave a Reply. |