You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/hypernode-platform/tools/how-to-use-node-js-and-npm-on-hypernode.md
+31-34Lines changed: 31 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ If you use the installed version, you can just start using node and npm.
22
22
23
23
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:
24
24
25
-
```nginx
25
+
```bash
26
26
hypernode-systemctl settings nodejs_version 18
27
27
```
28
28
@@ -34,15 +34,15 @@ If you want to execute the tools that you installed using `npm`, you should make
34
34
35
35
This PATH variable is used by the Bash shell to locate binaries and scripts. You can adjust it by exporting the PATH variable:
36
36
37
-
```nginx
38
-
export PATH="/data/web/node_modules/.bin:$PATH"
37
+
```bash
38
+
export PATH="/data/web/node_modules/.bin:$PATH"
39
39
```
40
40
41
41
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.
42
42
43
43
To configure your PATH variable at login time, run the following command:
@@ -52,61 +52,61 @@ Now every time you log in, the Bash shell is configured to look for tools in `/d
52
52
53
53
Let's install some packages.
54
54
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.
56
56
57
57
To find the latest command line tool installed, run: `ls -ltr /data/web/node_modules/.bin | tail -1`
58
58
59
59
### Install Gulp
60
60
61
-
```nginx
62
-
npm install gulp gulp-cli
61
+
```bash
62
+
npm install gulp gulp-cli
63
63
```
64
64
65
65
### Install Grunt
66
66
67
-
```nginx
67
+
```bash
68
68
npm install grunt grunt-cli
69
69
```
70
70
71
71
### Install Sass
72
72
73
-
```nginx
73
+
```bash
74
74
npm install sass
75
75
```
76
76
77
77
### Install Compass
78
78
79
-
```nginx
80
-
npm install compass
79
+
```bash
80
+
npm install compass
81
81
```
82
82
83
83
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
84
84
85
-
```nginx
85
+
```bash
86
86
gem install --user-install compass
87
87
```
88
88
89
89
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:
*To install yarn, a more recent version of nodejs is required, so [follow the instructions and download and unpack a newer version of nodejs](how-to-use-node-js-and-npm-on-hypernode.md#using-an-newer-version-of-node-js) 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.*
104
104
105
-
```nginx
105
+
```bash
106
106
npm install yarn
107
107
```
108
108
109
-
## **Using an newer version of Node.js**
109
+
## **Using a newer version of Node.js**
110
110
111
111
### **Install a newer version of Node.js**
112
112
@@ -118,39 +118,36 @@ All we need to do is download and unpack them to make use of node and npm and in
118
118
In this example we use version v14.17.6 but the installation process is the same when using older or newer versions.
119
119
120
120
- 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
+
```
126
124
- Then, get the precompiled package from the Node.js website and unpack it in our directory:
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`.
135
132
136
133
### Configure a Manually Installed Node.js
137
134
138
135
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.
139
136
140
137
To do this, run the following command to add the locations to your PATH:
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.
153
150
154
151
## Troubleshooting
155
152
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