Heroku git push error没有与节点匹配的版本:6.4.1

时间:2018-12-13 09:20:23

标签: node.js git heroku npm

我正在尝试将提交提交到heroku,我的npm和node版本均按要求指定。但是我仍然收到说“不符合”的错误 远程:Node.js的任何已发布版本。”。

当我们检查错误详细信息时,我们看到它忽略了我的版本,并尝试为节点6.4.1而不是npm设置版本。

完整的git错误消息:

>git push heroku master
Counting objects: 417, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (194/194), done.
Writing objects: 100% (417/417), 116.10 KiB | 12.90 MiB/s, done.
Total 417 (delta 224), reused 399 (delta 215)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  6.4.1
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 6.4.1...
remote:        Could not find Node version corresponding to version requirement: 6.4.1
remote:
remote: -----> Build failed
remote:
remote:  !     No matching version found for Node: 6.4.1
remote:
remote:        Heroku supports the latest Stable version of Node.js as well as all
remote:        active LTS (Long-Term-Support) versions, however you have specified
remote:        a version in package.json (6.4.1) that does not correspond to
remote:        any published version of Node.js.
remote:
remote:        You should always specify a Node.js version that matches the runtime
remote:        you’re developing and testing with. To find your version locally:
remote:
remote:        $ node --version
remote:        v6.11.1
remote:
remote:        Use the engines section of your package.json to specify the version of
remote:        Node.js to use on Heroku. Drop the ‘v’ to save only the version number:
remote:
remote:        "engines": {
remote:          "node": "6.11.1"
remote:        }
remote:
remote:        https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-no-matching-node-versions
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to app.
remote:
To https://git.heroku.com/app.git
 ! [remote rejected] master -> master (pre-receive hook declined)

packpage.json引擎节点:

"engines": {
    "node": "10.14.1",
    "npm": "6.4.1"
  }

当我在计算机上运行版本控制命令时:

node --version
v10.14.1

npm -version
6.4.1

1 个答案:

答案 0 :(得分:0)

我知道了。某些文件未添加到git中。

如果有人有相同的错误,则只需添加应用的all目录即可。

git add .

或者您只能添加packpage.json

git add packpage.json