Reputation: 23
Im trying to install node.js to shared dreamhost. I have followed the directions for Dan dean here http://dandean.com/nodejs-on-dreamhost-shared-server/
but when I go test, $ node --version Then it says:
-bash: node: command not found
I follow the step by step, this is the correct way to install the node in the shared server?
Upvotes: 2
Views: 4090
Reputation: 16588
Currently DreamHost says “Node.js can be installed onto Shared, VPS, and Dedicated Servers.” However, for shared servers, currently Node is only supported using Passenger, and the version of Passenger “running on DreamHost servers does not currently function with Node.js versions 14+” as of March 1, 2022. They have not shared a target date for allowing newer versions of Node.
For more instructions, and up-to-date compatibility information, see their support documentation on Node.js at Dreamhost.
Upvotes: 1
Reputation: 641
Dreamhost has supported Node.js on shared host recently. I put the following source code in app.js and it works.
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end("Hello World!\n");
});
server.listen(3000);
But it seems to be unstable when I try to restart it. Check https://help.dreamhost.com/hc/en-us/articles/217185397-Node-js-overview for details.
Upvotes: 3
Reputation: 322
It may not have been the case at the time this question was posted, but Dreamhost does not allow compiling or running nodejs on shared hosting.
Can Node.js be used on shared servers? No. DreamHost does not support Node.js on shared web servers, as the security setup on DreamHost shared servers is incompatible with compiling or running Node.js.
Furthermore, Dreamhost claims they will ban users who attempt to do so:
If you try to compile Node.js on one of the shared web servers, your user will automatically be banned through grsec (taking down all the PHP websites that run under that user) and the server will have to be rebooted before your user can be unbanned. If you do it one more time, you will be forced to move to a VPS.
I've had Dreamhost shared hosting for nearly 10 years, but they don't allow long-running processes. This also prevents common tools like composer from running if they take more than a few seconds. I recently moved to a VPS because of this.
https://help.dreamhost.com/hc/en-us/articles/217185397-Node-js-overview
Upvotes: 0
Reputation: 803
Sometimes, installing node.js on certain linux instances creates the command nodejs instead of node. Try nodejs --version. If you want to be able to use node as the command, simply create a simlink to /usr/local/bin/nodejs for /usr/local/bin/node.
Upvotes: 1
Reputation: 5136
You may want to look into nvm
when installing Node somewhere else than your local environment.
Check out my blog post on nvm: http://mycodesmells.com/post/node-version-management/
Upvotes: 1