I'm running version 3.1.2. I tried two workflows:
- Create a new directory.
- Run
codemod-cli new dir
- Run
codemod-cli generate codemod c
This will result in an error:
/Users/nheiner/.config/yarn/global/node_modules/yargs/build/index.cjs:2772
throw err;
^
Error: Cannot find module 'codemod-cli'
Require stack:
- /private/tmp/test-codemod/transforms/hoist-require/index.js
- /Users/nheiner/.config/yarn/global/node_modules/codemod-cli/src/transform-support.js
- /Users/nheiner/.config/yarn/global/node_modules/codemod-cli/commands/local/generate/fixture.js
- /Users/nheiner/.config/yarn/global/node_modules/yargs/index.cjs
- /Users/nheiner/.config/yarn/global/node_modules/codemod-cli/bin/cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/private/tmp/test-codemod/transforms/hoist-require/index.js:1:23)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/private/tmp/test-codemod/transforms/hoist-require/index.js',
'/Users/nheiner/.config/yarn/global/node_modules/codemod-cli/src/transform-support.js',
'/Users/nheiner/.config/yarn/global/node_modules/codemod-cli/commands/local/generate/fixture.js',
'/Users/nheiner/.config/yarn/global/node_modules/yargs/index.cjs',
'/Users/nheiner/.config/yarn/global/node_modules/codemod-cli/bin/cli.js'
]
}
Running yarn install fixes it. It's a reasonably straightforward fix, but it would be nice if the tool or docs were explicit about this requirement. It's a little surprising that running the same command stops working between steps.
When I did the same steps above, but in an existing monorepo, running generate before installing resulted in no files being written, but the command exited successfully.
I'm running version
3.1.2. I tried two workflows:codemod-cli new dircodemod-cli generate codemod cThis will result in an error:
Running
yarn installfixes it. It's a reasonably straightforward fix, but it would be nice if the tool or docs were explicit about this requirement. It's a little surprising that running the same command stops working between steps.When I did the same steps above, but in an existing monorepo, running
generatebefore installing resulted in no files being written, but the command exited successfully.