Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm-shrinkwrap.json - dependencies break when using git-url #1684

Closed
nathan-muir opened this issue Dec 13, 2013 · 5 comments
Closed

npm-shrinkwrap.json - dependencies break when using git-url #1684

nathan-muir opened this issue Dec 13, 2013 · 5 comments

Comments

@nathan-muir
Copy link
Contributor

@nathan-muir nathan-muir commented Dec 13, 2013

I'm using an NPM package in which some of it's dependencies are URL's/Git URL's to other packages. (https://npmjs.org/doc/json.html#dependencies)

However the packages/<package>/.npm/package/npm-shrinkwrap.json file records the version of the dependency - and not the URL.

So when meteor attempts to load the package dependencies using npm-shrinkwrap.json - it attempts to download the package from npmjs.org instead of the git/url that it came from.

@glasser
Copy link
Member

@glasser glasser commented Dec 18, 2013

This does sound like a bug, but please provide a clear reproduction recipe: a precise series of steps I can take (perhaps including git cloneing an example app) that will demonstrate the issue.

https://github.com/meteor/meteor/wiki/Contributing-to-Meteor#reporting-a-bug-in-meteor

@nathan-muir
Copy link
Contributor Author

@nathan-muir nathan-muir commented Dec 18, 2013

Hi @glasser

You can test with a development version of node-celery i've been working on. It uses a development version of node-amqp that i've also been fixing issues with.

my package (https://github.com/nathan-muir/meteor-celery) depends on a tarball (this isn't an issue)

Package.on_use(function (api) {
// ...
Npm.depends({"node-celery": 'https://github.com/nathan-muir/node-celery/tarball/b7309ae1b0b556312b28d8e769ed04cd37a768e7'});
// ...
});

node-celery's package.json however, depends on a git-url

{
 "version": "0.1.3",
 //...
  "dependencies": {
    "nathan-amqp": "git+https://github.com/nathan-muir/node-amqp.git",
    "node-uuid": "*"
  }
 //..
}

but npm-shrinkwrap.json produces

{
  "dependencies": {
    "node-celery": {
      "from": "https://github.com/nathan-muir/node-celery/tarball/b7309ae1b0b556312b28d8e769ed04cd37a768e7",
      "dependencies": {
        "nathan-amqp": {
          "version": "0.1.10"
        },
        "node-uuid": {
          "version": "1.4.1"
        }
      }
    }
  }
}

Initial loading of the package is fine - meteor will read from package.json inside node-celery and all is well.

However when meteor tries to load from npm-shrinkwrap.json it no-longer has the git-url used, and tries to load from npmjs.org - this is the bad bit.

eg.

...
npm ERR! 404 'nathan-amqp' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
...
couldn't install npm packages from npm-shrinkwrap
@glasser
Copy link
Member

@glasser glasser commented Dec 18, 2013

I am looking for instructions of the form "type this command, then type this command, then open your browser to this URL, then click this button".

@nathan-muir
Copy link
Contributor Author

@nathan-muir nathan-muir commented Dec 18, 2013

#!/bin/bash
cd ~
meteor create issue-1684
cd issue-1684
git clone https://github.com/nathan-muir/meteor-celery packages/celery
echo "celery" >> .meteor/packages
meteor
# package will complain about some stuff - just ignore and exit meteor
# remove build related stuff - leaving npm-shrinkwrap.json
rm -rf packages/celery/.npm/package/node_modules
rm -rf packages/celery/.build*
meteor
# meteor can't build package
@glasser glasser closed this in 0f4a21f Dec 18, 2013
@glasser
Copy link
Member

@glasser glasser commented Dec 18, 2013

Thanks, that clear comment made it easy to reproduce. (Even better is to future-proof recipes by specifying a meteor release in your "meteor" command (or just providing a reproduction as a git repo including the .meteor/release file, and to specify a commit on the other git clone command.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.