Skip to content

Commit 011c7a0

Browse files
authored
Merge pull request #72 from ByteInternet/fix-dead-link-nodejs-install
2 parents b415604 + 58ef788 commit 011c7a0

File tree

1 file changed

+31
-34
lines changed

1 file changed

+31
-34
lines changed

docs/hypernode-platform/tools/how-to-use-node-js-and-npm-on-hypernode.md

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ If you use the installed version, you can just start using node and npm.
2222

2323
By default, the installed NodeJS version on our Hypernode platform is v10. You can check this on your Hypernode by running the command `node -v`. If you need to manually upgrade an app to another Node.js version like 18, you can use the command below:
2424

25-
```nginx
25+
```bash
2626
hypernode-systemctl settings nodejs_version 18
2727
```
2828

@@ -34,15 +34,15 @@ If you want to execute the tools that you installed using `npm`, you should make
3434

3535
This PATH variable is used by the Bash shell to locate binaries and scripts. You can adjust it by exporting the PATH variable:
3636

37-
```nginx
38-
export PATH="/data/web/node_modules/.bin:$PATH"
37+
```bash
38+
export PATH="/data/web/node_modules/.bin:$PATH"
3939
```
4040

4141
If you want this setting to be configured every time you log in to your Hypernode, you can add this setting to your `~/.profile`, this file is loaded every time a new shell is spawned.
4242

4343
To configure your PATH variable at login time, run the following command:
4444

45-
```nginx
45+
```bash
4646
echo 'export PATH="/data/web/node_modules/.bin:$PATH"' >> ~/.profile
4747
```
4848

@@ -52,61 +52,61 @@ Now every time you log in, the Bash shell is configured to look for tools in `/d
5252

5353
Let's install some packages.
5454

55-
When your `PATH` is setup correctly, after the installation with `npm install`, you should immediately be able to use the newly installed tool.
55+
When your `PATH` is set up correctly, after the installation with `npm install`, you should immediately be able to use the newly installed tool.
5656

5757
To find the latest command line tool installed, run: `ls -ltr /data/web/node_modules/.bin | tail -1`
5858

5959
### Install Gulp
6060

61-
```nginx
62-
npm install gulp gulp-cli
61+
```bash
62+
npm install gulp gulp-cli
6363
```
6464

6565
### Install Grunt
6666

67-
```nginx
67+
```bash
6868
npm install grunt grunt-cli
6969
```
7070

7171
### Install Sass
7272

73-
```nginx
73+
```bash
7474
npm install sass
7575
```
7676

7777
### Install Compass
7878

79-
```nginx
80-
npm install compass
79+
```bash
80+
npm install compass
8181
```
8282

8383
When your Hypernode is using the OS [Debian Buster](https://changelog.hypernode.com/changelog/release-7351-new-hypernodes-will-be-booted-on-debian-buster/) then the aforementioned method will not be applicable. Instead you can use the following command to install compass
8484

85-
```nginx
85+
```bash
8686
gem install --user-install compass
8787
```
8888

8989
Next you need to set the correct path so you don't have to type the absolute path to access compass each time. You can do s with the command:
9090

91-
```nginx
91+
```bash
9292
export PATH="/data/web/.gem/ruby/2.5.0/gems/compass-1.0.3/bin:$PATH"
9393
```
9494

9595
### Install Less
9696

97-
```nginx
97+
```bash
9898
npm install less
9999
```
100100

101101
### Install Yarn
102102

103-
*To install yarn, a more recent version of nodejs is required, so*[*follow the instructions and download and unpack a newer version of nodejs*](https://archive.support.hypernode.com/knowledgebase/use-nodejs-npm-hypernode/#Using_a_newer_version_of_NodeJs)*first*
103+
*To install yarn, a more recent version of nodejs is required, so [follow the instructions and download and unpack a newer version of nodejs](#using-a-newer-version-of-nodejs) first.*
104104

105-
```nginx
105+
```bash
106106
npm install yarn
107107
```
108108

109-
## **Using an newer version of Node.js**
109+
## **Using a newer version of Node.js**
110110

111111
### **Install a newer version of Node.js**
112112

@@ -118,39 +118,36 @@ All we need to do is download and unpack them to make use of node and npm and in
118118
In this example we use version v14.17.6 but the installation process is the same when using older or newer versions.
119119

120120
- First, create the directory where we will unpack Node.js:
121-
122-
```nginx
123-
mkdir /data/web/.node
124-
```
125-
121+
```bash
122+
mkdir /data/web/.node
123+
```
126124
- Then, get the precompiled package from the Node.js website and unpack it in our directory:
125+
```bash
126+
wget https://nodejs.org/dist/v14.17.6/node-v14.17.6-linux-x64.tar.xz -O /tmp/node.txz
127+
cd ~/.node && tar xvfJ /tmp/node.txz -C . --strip-components=1
128+
rm /tmp/node.txz
129+
```
127130

128-
```nginx
129-
wget [https://nodejs.org/dist/v14.17.6/node-v14.17.6-linux-x64.tar.xz](https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz) -O /tmp/node.txz
130-
cd ~/.node && tar xvfJ /tmp/node.txz -C . --strip-components=1
131-
rm /tmp/node.txz
132-
```
133-
134-
That’s it, you now have a precompiled node installation in `~/node`
131+
That’s it, you now have a precompiled node installation in `~/node`.
135132

136133
### Configure a Manually Installed Node.js
137134

138135
To run the manually installed executables, you need to change your `PATH` variable to make sure your node is located by the Bash shell before the pre-installed version.
139136

140137
To do this, run the following command to add the locations to your PATH:
141138

142-
```nginx
143-
export PATH="/data/web/node_modules/.bin:/data/web/.node/bin:$PATH"
139+
```bash
140+
export PATH="/data/web/node_modules/.bin:/data/web/.node/bin:$PATH"
144141
```
145142

146143
Or to make the settings permanent, add it to your `~/.profile`:
147144

148-
```nginx
149-
echo 'export PATH="/data/web/node_modules/.bin:/data/web/.node/bin:$PATH"' >> ~/.profile
145+
```bash
146+
echo 'export PATH="/data/web/node_modules/.bin:/data/web/.node/bin:$PATH"' >> ~/.profile
150147
```
151148

152149
Both the installations (the already installed or the precompiled self-downloaded version) use `/data/web/node_modules` as their location to install new packages to when using npm.
153150

154151
## Troubleshooting
155152

156-
- When using npm search, so much memory is used that on Hypernode Grow plans, your shell will get killed and you’ll be automagically logged out of your Hypernode due to our out of memory protection.
153+
- When using npm search, so much memory is used that on Hypernode Grow plans, your shell will get killed, and you’ll be automagically logged out of your Hypernode due to our out of memory protection.

0 commit comments

Comments
 (0)