AdmitHub / meteor-buildpack-horse

Heroku buildpack for Meteor v1.0+. The horse one.
MIT License
641 stars 586 forks source link

Error building npm-container #79

Closed kartikTT closed 8 years ago

kartikTT commented 8 years ago

I'm unable to successfully push, looks like an issue with the npm container? I've tried remove and re-adding meteorhacks:npm. Am I missing something here?

Counting objects: 1446, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1381/1381), done.
Writing objects: 100% (1446/1446), 12.47 MiB | 998.00 KiB/s, done.
Total 1446 (delta 846), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Fetching set buildpack https://github.com/AdmitHub/meteor-buildpack-horse.git... done
remote: -----> Node.js app detected
remote: -----> Installing node
remote: -----> Installing meteor
remote: Downloading Meteor distribution
remote: ######################################################################## 100.0%
remote: 
remote: Meteor 1.3 has been installed in your home directory (~/.meteor).
remote: 
remote: Now you need to do one of the following:
remote: 
remote:   (1) Add "$HOME/.meteor" to your path, or
remote:   (2) Run this command as root:
remote:         cp "/tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/1.3.0_3/mt-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
remote: 
remote: Then to get started, take a look at 'meteor --help' or see the docs at
remote: docs.meteor.com.
remote: -----> Upgrading meteor to METEOR@1.2.1
remote: Installed. Run 'meteor update --release 1.2.1' inside of a particular project
remote: directory to update that project to Meteor 1.2.1.
remote: -----> Bundling bundle
remote: android: removed platform
remote: -----> Building Meteor with ROOT_URL: http://grocery-mobile-staging.herokuapp.com
remote: npm-container: updating npm dependencies -- node-tangocard, sendwithus...
remote: => Errors while initializing project:
remote: 
remote: While building package npm-container:
remote: error: couldn't install npm packages from npm-shrinkwrap: Command failed: npm
remote: WARN package.json packages-for-meteor-npm-container@0.0.0 No description
remote: npm WARN package.json packages-for-meteor-npm-container@0.0.0 No repository
remote: field.
remote: npm WARN package.json packages-for-meteor-npm-container@0.0.0 No README data
remote: npm ERR! Error: version not found: ansi-styles@2.2.0
remote: npm ERR!     at
remote: /tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/lib/cache/add-named.js:125:12
remote: npm ERR!     at saved
remote: (/tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:167:7)
remote: npm ERR!     at Object.oncomplete (fs.js:108:15)
remote: npm ERR! If you need help, you may report this *entire* log,
remote: npm ERR! including the npm and node versions, at:
remote: npm ERR!     <http://github.com/npm/npm/issues>
remote: 
remote: npm ERR! System Linux 3.13.0-79-generic
remote: npm ERR! command
remote: "/tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
remote: "/tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm"
remote: "install"
remote: npm ERR! cwd
remote: /tmp/build_b9ee10db97c4547eacaf8554aa59d15e/packages/npm-container/.npm/package-new-39lcwz
remote: npm ERR! node -v v0.10.40
remote: npm ERR! npm -v 1.4.28
remote: npm ERR! not ok code 0
remote: npm WARN package.json packages-for-meteor-npm-container@0.0.0 No description
remote: npm WARN package.json packages-for-meteor-npm-container@0.0.0 No repository
remote: field.
remote: npm WARN package.json packages-for-meteor-npm-container@0.0.0 No README data
remote: npm ERR! Error: version not found: ansi-styles@2.2.0
remote: npm ERR!     at
remote: /tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/lib/cache/add-named.js:125:12
remote: npm ERR!     at saved
remote: (/tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:167:7)
remote: npm ERR!     at Object.oncomplete (fs.js:108:15)
remote: npm ERR! If you need help, you may report this *entire* log,
remote: npm ERR! including the npm and node versions, at:
remote: npm ERR!     <http://github.com/npm/npm/issues>
remote: 
remote: npm ERR! System Linux 3.13.0-79-generic
remote: npm ERR! command
remote: "/tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
remote: "/tmp/buildpack20160328-163-zdgui9/meteor-OK3V/.meteor/packages/meteor-tool/.1.1.10.1yce4a7++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm"
remote: "install"
remote: npm ERR! cwd
remote: /tmp/build_b9ee10db97c4547eacaf8554aa59d15e/packages/npm-container/.npm/package-new-39lcwz
remote: npm ERR! node -v v0.10.40
remote: npm ERR! npm -v 1.4.28
remote: npm ERR! not ok code 0
remote: 
remote: 
remote: 
remote:  !     Push rejected, failed to compile Node.js app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected
yourcelf commented 8 years ago

The key to the error:

remote: npm ERR! Error: version not found: ansi-styles@2.2.0

Your project is requesting that npm install https://www.npmjs.com/package/ansi-styles at version 2.2.0, but there is no release published with that version string. Try finding the package.json that declares ansi-styles v 2.2.0 and replacing it with 2.2.1, which exists.

kartikTT commented 8 years ago

Thanks for the quick response! I'm not specifying ansi-styles in my own packages.json, in the npm-shrinkwrap.json file I see the following:

    "ansi-styles": {
      "version": "1.1.0",
      "from": "ansi-styles@>=1.1.0 <2.0.0",
      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz"
    },

but that shouldn't be a problem?

yourcelf commented 8 years ago

That looks like it shouldn't be a problem. But something else somewhere (perhaps a subdependency) is declaring 2.2.0. Try to see if there's something else you're depending on which specifies another version. There are a lot of things that depend on ansi-styles.

kartikTT commented 8 years ago

OK looks like I found the cause deep within one of my packages dependencies (see the ansi-styles dependency at the bottom). Not quite sure how I can edit the ansi dependency for chalk? Also, hasn't been an issue in any of my previous pushes with this buildpack.

{
  "dependencies": {
    "node-tangocard": {
      "version": "0.1.1",
      "dependencies": {
        "request": {
          "version": "2.69.0",
          "dependencies": {
            "aws-sign2": {
              "version": "0.6.0"
            },
            "aws4": {
              "version": "1.2.1",
              "dependencies": {
                "lru-cache": {
                  "version": "2.7.3"
                }
              }
            },
            "bl": {
              "version": "1.0.3",
              "dependencies": {
                "readable-stream": {
                  "version": "2.0.5",
                  "dependencies": {
                    "core-util-is": {
                      "version": "1.0.2"
                    },
                    "inherits": {
                      "version": "2.0.1"
                    },
                    "isarray": {
                      "version": "0.0.1"
                    },
                    "process-nextick-args": {
                      "version": "1.0.6"
                    },
                    "string_decoder": {
                      "version": "0.10.31"
                    },
                    "util-deprecate": {
                      "version": "1.0.2"
                    }
                  }
                }
              }
            },
            "caseless": {
              "version": "0.11.0"
            },
            "combined-stream": {
              "version": "1.0.5",
              "dependencies": {
                "delayed-stream": {
                  "version": "1.0.0"
                }
              }
            },
            "extend": {
              "version": "3.0.0"
            },
            "forever-agent": {
              "version": "0.6.1"
            },
            "form-data": {
              "version": "1.0.0-rc3",
              "dependencies": {
                "async": {
                  "version": "1.5.2"
                }
              }
            },
            "har-validator": {
              "version": "2.0.6",
              "dependencies": {
                "chalk": {
                  "version": "1.1.1",
                  "dependencies": {
                   "ansi-styles": {
                      "version": "2.2.1",
                      "dependencies": {
                        "color-convert": {
                          "version": "1.0.0"
                        }
                      }
                    },
yourcelf commented 8 years ago

Looks like the thing you're quoting asks for ansi-styles version 2.2.1, so I don't think that's it. Your problem version is 2.2.0.

The buildpack recently started installing packages with npm for users of meteor 1.3 (https://github.com/AdmitHub/meteor-buildpack-horse/commit/eb6bb6cdbe098183f708f47c789348c06e1b5d52 )... so my guess would be either you weren't installing the node deps at all before, or you upgraded something to a version that referenced a subdependency with the wonky version.

kartikTT commented 8 years ago

Changing the version here doesn't solve, this is within my .meteor/local/isopacks/npm-container/node_modules/.npm-shrinkwrap.json

I think this is compiled on build? In which case I'd need to specify the version elsewhere but not sure where?

I'm on meteor 1.2.1 and the buildpack seems to be sticking with that when I push.

yourcelf commented 8 years ago

You'd need to change it in the upstream dependency (e.g. with a pull request to node-tangocard), not with a change to meteor's generated shrinkwrap file.

Can you share your complete package.json?

kartikTT commented 8 years ago

Here's my packages.json for npm modules (only using two):

{
    "node-tangocard":"0.1.1",
    "sendwithus":"2.9.0"
}

For node-tangocard the only dependency is request@^2.51.0 - with ansi-styles nested deep within it, how would I change that version?

Here's the full package.json for the node-tangocard module:

{
  "name": "node-tangocard",
  "version": "0.1.1",
  "description": "tangocard node.js simple sdk",
  "main": "tangocard.js",
  "scripts": {
    "test": "./node_modules/mocha/bin/mocha -R spec --timeout 30000"
  },
  "contributors": [
    {
      "name": "Igor Skrynkovskyy",
      "email": "skrynkovskyy@gmail.com"
    }
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/h2rd/node-tangocard.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/h2rd/node-tangocard/issues"
  },
  "homepage": "https://github.com/h2rd/node-tangocard",
  "dependencies": {
    "request": "^2.51.0"
  },
  "devDependencies": {
    "chai": "^1.10.0",
    "mocha": "^2.1.0"
  },
  "gitHead": "c757c5b415ca321a6bd3651253e84451aa9d2b44",
  "_id": "node-tangocard@0.1.1",
  "_shasum": "c5e297d4f43ab49910da6ab00f981f5f0f87deab",
  "_from": "node-tangocard@0.1.1",
  "_npmVersion": "2.5.1",
  "_nodeVersion": "0.12.0",
  "_npmUser": {
    "name": "h2rd",
    "email": "skrynkovskyy@gmail.com"
  },
  "maintainers": [
    {
      "name": "h2rd",
      "email": "skrynkovskyy@gmail.com"
    }
  ],
  "dist": {
    "shasum": "c5e297d4f43ab49910da6ab00f981f5f0f87deab",
    "tarball": "http://registry.npmjs.org/node-tangocard/-/node-tangocard-0.1.1.tgz"
  },
  "directories": {},
  "_resolved": "https://registry.npmjs.org/node-tangocard/-/node-tangocard-0.1.1.tgz",
  "readme": "ERROR: No README data found!"
}
yourcelf commented 8 years ago

I have a hunch that the ansi-styles problem has fixed itself. The version of node-tangocard that you are requesting percolates down to chalk@1.1.3 which declares ansi-styles ^2.2.1. This was updated 17 hours ago: https://github.com/chalk/chalk/commit/0d8d8c204eb87a4038219131ad4d8369c9f59d24

If you're still having errors when building on heroku, I think there's another error happening; the ansi-styles@2.2.0 issue shouldn't exist anymore unless you've somehow frozen an npm-shrinkwrap.

kartikTT commented 8 years ago

OK looks like we're close. I did the following:

1) reset my project 2) deleted npm-container & removed meteorhacks:npm 3) added meteorhacks:npm & ran the app

After doing this the .npm-shrinkwrap.json file shows:

"ansi-styles": {
       "version": "2.2.1"
 },

as you'd predicted and we want.

But when I push to heroku I get the same ansi-styles error (version not found: ansi-styles@2.2.0). Is there a config I need to change in the buildpack? Why would the app be loading the wrong version here when it looks for the updated version when I run locally?

yourcelf commented 8 years ago

Have you committed your changes since reloading npm?

kartikTT commented 8 years ago

Yup, committed after the steps I wrote above.

Also tried pushing to a brand new heroku app and still seeing the same error

kartikTT commented 8 years ago

My packages/npm-container/.npm/package/.gitignore has node_modules listed. I tried removing this and re-committing which adds all files in the directory but same error

kartikTT commented 8 years ago

Found a solution: Did all the steps mentioned above followed by:

heroku config:set NODE_MODULES_CACHE=FALSE

was able to push successfully. Hopefully that was the cause, though could have been something else. Will monitor closely and re-open if anything goes south. @yourcelf thanks for the help!

diegonc commented 8 years ago

Today I encountered the same error with ansi-styles because I was depending on the request package through meteorhacks:npm.

For future readers, what I did to solve this issue was:

  1. Delete packages/npm-continer/.npm/package/npm-shrinkwrap.json
  2. Run the meteor project to allow meteorhacks:npm to recreate the file above
  3. Commit the new json file
  4. Push to heroku

The problem was that the json file was under source control and the versions indicated there were used preventing npm from picking newer packages that do not depend on the removed version of ansi-styles. So the steps above are just refreshing the file. I don't know if there's another way of doing it.