Closed lukeapage closed 8 years ago
the first issue with the global install not finding jscodeshift might relate to : https://github.com/nzakas/shelljs-nodecli/issues/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.
@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!
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?
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.
Much better. Thanks!
First problem was after I installed globally..
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...
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...
and that works fine. I'm running in git bash on windows.