Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with installing Node.js on Hostinger shared-hosting

I have installed Node.js on my Hostinger shared-hosting according to https://medium.com/@mayomi1/how-to-host-a-node-js-app-on-shared-host-52e12a62a259.

When I try to use npm install fibers or npm install from the following package.json.

{
  "name": "mekkaniko",
  "version": "1.0.0",
  "description": "Nuxt Express WebApp",
  "author": "iotronlab",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
    "build": "nuxt build",
    "start": "cross-env NODE_ENV=production node server/index.js",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "nuxt": "^2.0.0",
    "cross-env": "^5.2.0",
    "express": "^4.16.4",
    "@nuxtjs/axios": "^5.3.6",
    "@nuxtjs/pwa": "^3.0.0-0"
  },
  "devDependencies": {
    "nodemon": "^1.18.9",
    "@nuxtjs/vuetify": "^1.0.0",
    "eslint-config-prettier": "^4.1.0",
    "eslint-plugin-prettier": "^3.0.1",
    "prettier": "^1.16.4"
  }
}

I get the error log

1404 verbose stack Error: [email protected] install: `node build.js || nodejs build.js`
1404 verbose stack spawn ENOENT
1404 verbose stack     at ChildProcess.<anonymous> (/home/u363303914/.nvm/versions/node/v12.8.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
1404 verbose stack     at ChildProcess.emit (events.js:203:13)
1404 verbose stack     at maybeClose (internal/child_process.js:1021:16)
1404 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
1405 verbose pkgid [email protected]
1406 verbose cwd /home/u363303914/domains/mekkaniko.com/public_html
1407 verbose Linux 3.10.0-962.3.2.lve1.5.25.10.el7.x86_64
1408 verbose argv "/home/u363303914/.nvm/versions/node/v12.8.1/bin/node" "/home/u363303914/.nvm/versions/node/v12.8.1/bin/npm" "install" "fibers"
1409 verbose node v12.8.1
1410 verbose npm  v6.10.2
1411 error file sh
1412 error code ELIFECYCLE
1413 error errno ENOENT
1414 error syscall spawn
1415 error [email protected] install: `node build.js || nodejs build.js`
1415 error spawn ENOENT
1416 error Failed at the [email protected] install script.
1416 error This is probably not a problem with npm. There is likely additional logging output above.
1417 verbose exit [ 1, true ]
like image 268
Anik Adhikary Avatar asked Jan 26 '23 22:01

Anik Adhikary


1 Answers

Updated version:

The other answer provides a good starting point but it is outdated and the versions 18 and 19 will return errors, including:

GLIBC_2.27 not found

The way I managed to make it work is:

wget -qO- https://cdn.rawgit.com/creationix/nvm/master/install.sh | bash

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

nvm install 16

Then you will be using node version 16 and will not return any errors.

In case you get the error

Permission denied on laravel mix

A simple rebuild will fix it:

npm rebuild
like image 191
HeytalePazguato Avatar answered Jan 29 '23 09:01

HeytalePazguato