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

标签 javascript node.js shared-hosting nvm

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

当我尝试从以下 package.json 使用 npm install 纤程或 npm install 时。

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

最佳答案

按着这些次序:

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

关于javascript - 在 Hostinger 共享主机上安装 Node.js 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57538515/

相关文章:

php - 对于连接速度慢的人来说,下载用 PHP 提供的大型(ish)zip 文件会损坏

php - 从共享主机发送的电子邮件,已阻止。有没有办法避免这种情况?

python - Django,可以运行两个不同的版本吗?

javascript - 如何使用 JavaScript 启用 IE9 中的工具栏?

javascript - 我的数据库文件有什么问题?

node.js - 未从 nodejs 产生的进程接收标准输出

javascript - NodeJS MySQL 如何获取查询函数之外的结果

node.js - 无法读取未定义的属性 'activities'

javascript - 以异步方式发送网格邮件

javascript - 即 10 : SCRIPT5: Access is Denied error on anchor click event