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

Problems running (in windows?) #2

Closed
lukeapage opened this issue Jul 5, 2016 · 5 comments
Closed

Problems running (in windows?) #2

lukeapage opened this issue Jul 5, 2016 · 5 comments
Labels

Comments

@lukeapage
Copy link

First problem was after I installed globally..

$ eslint-transforms new-rule-format src/rules/in-params.js
c:\Program Files (x86)\nodejs\node_modules\eslint-transforms\node_modules\shelljs-nodecli\lib\shelljs-nodecli.js:104
            throw new Error("Couldn't find " + name + ".");
            ^

Error: Couldn't find jscodeshift.
    at Object.module.exports.exec (c:\Program Files (x86)\nodejs\node_modules\eslint-transforms\node_modules\shelljs-nodecli\lib\shelljs-nodecli.js:104:19)
    at Object.<anonymous> (c:\Program Files (x86)\nodejs\node_modules\eslint-transforms\bin\eslint-transforms.js:11:9)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:138:18)
    at node.js:974:3

I found this very strange since js-codeshift should have been findable. Possibly npm corrupted the install or something?

So I decided to installl locally and run there, which worked better, but I couldn't get it to run...

Luke@LUKE-VAIO /c/git/eslint-plugin-destructuring (master)
$ ./node_modules/.bin/eslint-transforms  new-rule-format src/rules/in-params.js
ERROR Transform file c:\git\eslint-plugin-destructuring\lib\new-rule-format\new-rule-format.js does not exist

Luke@LUKE-VAIO /c/git/eslint-plugin-destructuring (master)
$ ./node_modules/.bin/eslint-transforms  node_modules/eslint-transforms/lib/new-rule-format src/rules/in-params.js
ERROR Transform file c:\git\eslint-plugin-destructuring\lib\node_modules\eslint-transforms\lib\new-rule-format\node_modules\eslint-transforms\lib\new-rule-format.js does not exist

Luke@LUKE-VAIO /c/git/eslint-plugin-destructuring (master)
$ ./node_modules/.bin/eslint-transforms  node_modules/eslint-transforms/lib/new-rule-format src/rules in-params.js
ERROR Transform file c:\git\eslint-plugin-destructuring\lib\node_modules\eslint-transforms\lib\new-rule-format\node_modules\eslint-transforms\lib\new-rule-format.js does not exist

Luke@LUKE-VAIO /c/git/eslint-plugin-destructuring (master)
$ ./node_modules/.bin/eslint-transforms  ../node_modules/eslint-transforms/lib/new-rule-format src/rules in-params.js
ERROR Transform file c:\git\eslint-plugin-destructuring\node_modules\eslint-transforms\lib\node_modules\eslint-transforms\lib\new-rule-format.js does not exist

Luke@LUKE-VAIO /c/git/eslint-plugin-destructuring (master)
$ ./node_modules/.bin/eslint-transforms  ../node_modules/eslint-transforms/lib/new-rule-format/new-rule-format src/rules/in-params.js
ERROR Transform file c:\git\eslint-plugin-destructuring\node_modules\eslint-transforms\lib\new-rule-format\node_modules\eslint-transforms\lib\new-rule-format\new-rule-format.js does not exist

Luke@LUKE-VAIO /c/git/eslint-plugin-destructuring (master)
$ ./node_modules/.bin/eslint-transforms  ../new-rule-format src/rules/in-params.js
ERROR Transform file c:\git\eslint-plugin-destructuring\new-rule-format.js does not exist

I couldn't get it to load the rule.

I noticed when running eslint-transforms by itself it still reports itself as jscodeshift, so I tried this instead...

$ ./node_modules/.bin/jscodeshift src/rules/in-params.js -t node_modules/eslint-transforms/lib/new-rule-format/new-rule-format.js

and that works fine. I'm running in git bash on windows.

@lukeapage
Copy link
Author

the first issue with the global install not finding jscodeshift might relate to : nzakas/shelljs-nodecli#2

The 2nd is probably due to the fact I'm running this from .bin while in a different directory and the relative path to the transform isn't working.

@vitorbal
Copy link
Member

vitorbal commented Jul 5, 2016

@lukeapage thank you for the bug report! The 2nd issue is due to the fact that the executable was not using __dirname to resolve the location of the transforms.. apologies for that. #3 should make sure this doesn't happen anymore.

For the first issue described I'm afraid I need some help figuring out if it indeed relates to nzakas/shelljs-nodecli#2. @platinumazure sorry to bug you, but since you reported that issue originally, do you happen to know if this is true?

edit: nevermind, seems I figured out a solution for this thanks to @nzakas. Will try to submit a fix today!

@vitorbal vitorbal added bug and removed triage labels Jul 5, 2016
vitorbal added a commit to vitorbal/eslint-transforms that referenced this issue Jul 5, 2016
vitorbal added a commit to vitorbal/eslint-transforms that referenced this issue Jul 7, 2016
@nzakas nzakas closed this as completed in 6219d0c Jul 7, 2016
@lencioni
Copy link

I've run into a similar issue just now on OS X in zsh. Node 6.2.2, npm 3.9.5, nvm 0.30.1. I just tried updating nvm to 0.31.3, and same problem.

I installed by running npm install -g eslint-transforms. This seemed to include jscodeshift:

└─┬ eslint-transforms@0.0.1
  ├─┬ jscodeshift@0.3.26

When I run eslint-transforms, I get the same error:

/path/to/.nvm/versions/node/v6.2.2/lib/node_modules/eslint-transforms/node_modules/shelljs-nodecli/lib/shelljs-nodecli.js:104
            throw new Error("Couldn't find " + name + ".");
            ^

Error: Couldn't find jscodeshift.
    at Object.module.exports.exec (/path/to/.nvm/versions/node/v6.2.2/lib/node_modules/eslint-transforms/node_modules/shelljs-nodecli/lib/shelljs-nodecli.js:104:19)
    at Object.<anonymous> (/path/to/.nvm/versions/node/v6.2.2/lib/node_modules/eslint-transforms/bin/eslint-transforms.js:11:9)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (node.js:348:7)
    at startup (node.js:140:9)

It looks like it brought in shelljs-nodecli@0.1.1, if that helps debug anything. Perhaps this is an issue when using node only via nvm?

lencioni added a commit to lencioni/eslint-plugin-react that referenced this issue Jul 28, 2016
I updated this via the codemod from eslint-transforms. [I ran into some
errors getting eslint-transforms to run correctly as described][0], but
I was able to find a workaround by running the jscodeshift command
directly.

[0]: eslint/eslint-transforms#2 (comment)

This is a completely automated change.
lencioni added a commit to lencioni/eslint-plugin-react that referenced this issue Jul 28, 2016
I updated this via the codemod from eslint-transforms. [I ran into some
errors getting eslint-transforms to run correctly as described][0], but
I was able to find a workaround by running the jscodeshift command
directly.

[0]: eslint/eslint-transforms#2 (comment)

This is a completely automated change.
@nzakas
Copy link
Member

nzakas commented Jul 29, 2016

The fix hadn't been released even though it was merged. I just did a release so if you update the package it should work.

@lencioni
Copy link

Much better. Thanks!

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

No branches or pull requests

5 participants