-
Hi, I'm trying to run some scripts from the react-codemod library. I'm currently getting this error on
I understand the problem, however I'm not sure exactly how to fix this one because it seems the library is trying to access I did add the following to my .yarnrc file, however, it did not fix the issue.
How would I solve this? Would I need to unplug the package or use some special naming conversion? I tried using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It's an issue with how they try to locate the binary for With that out of the way here is a patch you can apply to fix it using https://yarnpkg.com/features/protocols/#patch diff --git a/bin/cli.js b/bin/cli.js
index 6640b376d7f449e8551eb970cadf267784224adb..b34fc4117952c01b7d630fbc3053fa73c855be9f 100644
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -17,7 +17,7 @@ const chalk = require('chalk');
const isGitClean = require('is-git-clean');
const transformerDirectory = path.join(__dirname, '../', 'transforms');
-const jscodeshiftExecutable = require.resolve('.bin/jscodeshift');
+const jscodeshiftExecutable = require.resolve('jscodeshift/bin/jscodeshift.js');
function checkGitStatus(force) {
let clean = false;
@@ -113,7 +113,7 @@ function runTransform({ files, flags, parser, transformer, answers }) {
console.log(`Executing command: jscodeshift ${args.join(' ')}`);
- const result = execa.sync(jscodeshiftExecutable, args, {
+ const result = execa.sync('node', [jscodeshiftExecutable, ...args], {
stdio: 'inherit',
stripEof: false
});
|
Beta Was this translation helpful? Give feedback.
It's an issue with how they try to locate the binary for
jscodeshift
(https://github.com/reactjs/react-codemod/blob/b34b92a1f0b8ad333efe5effb50d17d46d66588b/bin/cli.js#L20), Yarn in PnP mode will never produce that file so even if we allowed undeclared requires for dotfiles (.bin
,.cache
et al) it will never get a match.With that out of the way here is a patch you can apply to fix it using https://yarnpkg.com/features/protocols/#patch