尝试将Node.js应用程序部署到Heroku时出错

时间:2020-04-01 19:13:12

标签: node.js git heroku npm node-pre-gyp

尝试将节点应用程序部署到Heroku。

得到一个名为错误的错误:生成我无法解决的node-gyp EACCES。

我尝试了一些尝试,但仍然遇到相同的错误。

我在网上找到了三个提示,说应该可以奏效,但是没有运气

  1. 引擎行到packahe.json
  2. postinstall行到package.json
  3. 我还安装了-npm config设置为unsafe-perm true

remote:        > nodegit@0.26.5 install /tmp/build_26312d384462364fdd77b0383f45ef24/node_modules/nodegit
remote:        > node lifecycleScripts/preinstall && node lifecycleScripts/install
remote:
remote:        [nodegit] Running pre-install script
remote:        [nodegit] Running install script
remote:        events.js:292
remote:              throw er; // Unhandled 'error' event
remote:              ^
remote:
remote:        Error: spawn node-pre-gyp EACCES
remote:            at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
remote:            at onErrorNT (internal/child_process.js:467:16)
remote:            at processTicksAndRejections (internal/process/task_queues.js:84:21)
remote:        Emitted 'error' event on ChildProcess instance at:
remote:            at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
remote:            at onErrorNT (internal/child_process.js:467:16)
remote:            at processTicksAndRejections (internal/process/task_queues.js:84:21) {
remote:          errno: -13,
remote:          code: 'EACCES',
remote:          syscall: 'spawn node-pre-gyp',
remote:          path: 'node-pre-gyp',
remote:          spawnargs: [ 'install', '--fallback-to-build' ]
remote:        }
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 1
remote:        npm ERR! nodegit@0.26.5 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the nodegit@0.26.5 install script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:

Package.json 我发现onlone只是添加了要告诉我可以解决的引擎行和安装后的安装,但没有运气。

{
  "name": "msddgffdapackage",
  "engines" : { "node" : ">=0.12" },
  "version": "1.0.0",
  "main": "server.js",
  "dependencies": {
    "body-parser": "^1.19.0",
    "connect-ensure-login": "^0.1.1",
    "ejs": "^3.0.1",
    "express": "^4.17.1",
    "express-handlebars": "^3.1.0",
    "express-session": "^1.17.0",
    "git": "^0.1.5",
    "mongodb": "^3.5.5",
    "mongoose": "^5.9.6",
    "morgan": "^1.9.1",
    "nodegit": "^0.26.5",
    "passport": "^0.4.1",
    "passport-local": "^1.0.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "postinstall": "chmod -R +x node_modules/next/dist/bin/next-* && npm run build",
    "start": "node server.js"
  },
  "author": "",
  "license": "ISC",
  "description": ""
}
``

0 个答案:

没有答案