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

strange --global behavior #73

Open
duralog opened this issue Jul 14, 2014 · 4 comments
Open

strange --global behavior #73

duralog opened this issue Jul 14, 2014 · 4 comments

Comments

@duralog
Copy link

duralog commented Jul 14, 2014

it gets mixed up with locals and globals for resolution... actually, this could be a npmd-resolve issue now that I think about it, but either way, it can be reproduced like this:

  1. npmd install npmd-config --greedy to install locally
  2. npmd install -g npmd-config --greedy to install globally
  3. give npmd-config a try now on the terminal, and it will tell you that it can't find optimist

right, so if you go to any other directory now and re-run the npmd install -g npmd-config, the --global option will install the missing deps

I don't think the greedy option makes any difference (didn't actually try it ... and come to think of it, why isn't greedy on by default?)

love npmd man :) it's great
keep it real

@dominictarr
Copy link
Owner

I have not been able to reproduce this - are you using the latest version on npmd?

@dominictarr
Copy link
Owner

can you post output of npmd-config ?

@duralog
Copy link
Author

duralog commented Jul 20, 2014

sure

{
  "0": "npmd-config",
  "dbPath": "/Users/duralog/.npmd",
  "debug": false,
  "sync": false,
  "registry": "https://registry.npmjs.org",
  "cache": "/Users/duralog/.npm",
  "user-agent": "node/v0.10.28 darwin x64",
  "prefix": "/usr/local",
  "port": 5656,
  "_": [],
  "global": null,
  "g": null,
  "greedy": null,
  "dedupe": null,
  "online": null,
  "offline": null,
  "save-dev": null,
  "D": null,
  "saveDev": null,
  "save": null,
  "S": null,
  "$0": "npmd-config",
  "bin": "/tmp/npmd-config-bug/node_modules/.bin",
  "userAgent": "node/v0.10.28 darwin x64",
  "": [],
  "d": null,
  "s": null
}

lemme look a bit more into this a second...
aha! I found the bug. you can reproduce perfectly like this:

mkdir -p /tmp/npmd-bug
cd /tmp/npmd-bug
cat  > package.json << EOL
{
    "name": "npmd-test",
    "dependencies": {
        "optimist": "x"
    }
}
EOL
npmd install
npmd install npmd-config --greedy --global

now try it :)

notes:

  1. if you rm -rf node_modules/optimist (even though it's in package.json dependencies) it will now install properly.
  2. the greedy tag is indeed the culprit. appears that it makes npmd greedy locally as well globally (insert multinational corporation joke here)

@dominictarr
Copy link
Owner

aha, so it's probably rchecking for already available modules in the ./node_modules etc, but it should look for that starting from where it will be installed (or just skip that step for global modules)

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

No branches or pull requests

2 participants