在Hostinger共享主机上安装Node.js的问题

时间:2019-08-17 17:32:34

标签: javascript node.js shared-hosting nvm

我已经根据以下说明在Hostinger共享主机上安装了Node.js: https://medium.com/@mayomi1/how-to-host-a-node-js-app-on-shared-host-52e12a62a259

当我尝试使用npm安装光纤或从以下package.json安装npm时。

{
  "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"
  }
}

我收到错误日志

1404 verbose stack Error: fibers@4.0.1 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 fibers@4.0.1
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 fibers@4.0.1 install: `node build.js || nodejs build.js`
1415 error spawn ENOENT
1416 error Failed at the fibers@4.0.1 install script.
1416 error This is probably not a problem with npm. There is likely additional logging output above.
1417 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:0)

请按照以下步骤操作:

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 node
nvm use node