简体   繁体   English

Heroku使用较旧版本的package.json构建

[英]Heroku builds with a older version of package.json

I am pushing a Node app to Heroku with a package.json file with version "1.0.0", but when Heroku is installing dependencies and building, I saw it is using package.json file with version "0.3.0" from a while back. 我使用带有版本“ 1.0.0”的package.json文件将Node应用程序推送到Heroku,但是当Heroku安装依赖项并进行构建时,我看到它使用了版本为“ 0.3.0”的package.json文件背部。

Here is a sample of my package.json 这是我的package.json的示例

 {
  "name": "ProjectName",
  "version": "1.0.0",
  "description": "...",
  "repository": "https://github.com/...",
  "main": "index.js",
  "scripts": {
    "clean": "rimraf public",
    "start": "NODE_ENV=production node server/index.js",
    "dev": "NODE_ENV=development node server/index.js",
    "build:webpack": "NODE_ENV=production webpack --progress --colors --config ./webpack/webpack.config.prod.js",
    "build": "npm run clean && npm run build:webpack",
    "test": "karma start",
    "test:watch": "npm test -- --watch --no-single-run"
  },
  "author": "...",

I tried npm cache clean but didn't work. 我尝试清理npm缓存,但是没有用。

I used another machine to push again. 我用另一台机器再次推动。 This time Heroku sees a version "1.0.0" package.json BUT an OLDER version of it. 这次Heroku看到版本“ 1.0.0” package.json,但是它的版本更 It has packages I previously deleted, and doesn't have packages I installed after some point in time. 它包含我以前删除的软件包,并且在某个时间点之后没有安装我的软件包。 So I was suspecting I didn't git commit the latest package.json, but I have. 所以我怀疑我没有git提交最新的package.json,但是我有。

Is this because I don't have a .npmrc config file? 这是因为我没有.npmrc配置文件吗? How do I set one so Heroku will correctly install dependencies in the latest version of package.json? 如何设置一个,以便Heroku可以在最新版本的package.json中正确安装依赖项?

So I found that to push to heroku/master you will have to be at master of your project as well. 因此,我发现要推送到heroku / master,您也必须是项目的主人。

I was at another branch and pushing to heroku/master. 我当时在另一个分支,并推向heroku / master。 That's why - My master branch has an outdated package.json. 这就是为什么-我的master分支有一个过时的package.json。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM