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

basedir incorrectly resolved on msysgit #16

Closed
bgoscinski opened this issue Apr 5, 2016 · 3 comments
Closed

basedir incorrectly resolved on msysgit #16

bgoscinski opened this issue Apr 5, 2016 · 3 comments

Comments

@bgoscinski
Copy link

Hi
I recently upgraded node from v0.12.4 to v5.10.0 (which comes with npm@3.8.3 which comes with cmd-shim@2.0.2), installed jspm (but it can be any node module) globally and got:

$ jspm init
module.js:341
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\Git\node_modules\jspm\jspm.js'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:146:18)
    at node.js:404:3

Path C:\Program Files\Git\node_modules\jspm\jspm.js is incorrect as in my case it should be C:\.tools\nodejs\node_modules\jspm\jspm.js. I found that it can be resolved by reverting change introduced by #4 (/cc @copenhas):

 #!/bin/sh
-basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
+basedir=`dirname "$0"`

 case `uname` in
     *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
 if [ -x "$basedir/node" ]; then
   "$basedir/node"  "$basedir/node_modules/jspm/jspm.js" "$@"
   ret=$?
 else
   node  "$basedir/node_modules/jspm/jspm.js" "$@"
   ret=$?
 fi

I'm having the same issue on 2 machines with similar setup: Windows 10 and Git Bash which comes with Git for Windows 2.8.1 (https://chocolatey.org/packages/git).

As a workaround I found that invoking jspm.cmd init works as it should.

@bgoscinski
Copy link
Author

Problem also occurs with

$ npm -v
2.15.0
$ node -v
v4.4.2

@copenhas
Copy link
Contributor

copenhas commented Apr 6, 2016

Dang, I apologize that my change is causing issues. The change was to swap out the escaped \ with a / so that bash would properly resolve the path.

Looks like the base directory is resolving incorrectly for you. Out of curiosity does it work from regular cmd.exe? I'll try to test a couple of scenarios when I'm back on a Windows machine.

@bgoscinski
Copy link
Author

It does work in cmd.exe but it is no surprise because it runs *.cmd even if I omit it in invocation. What is strange is that I also had some problems with Git for Windows (with git rebase to be more specific) so I downgraded to

$ git --version
git version 2.6.4.windows.1

...and now everything seems fine.

So it turns out it is a problem with newer Git for Windows. Sorry for wasting your time!

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