I kept getting this error when I tried to run yarn add hasura-cli -D
:
Output:
node:internal/modules/cjs/loader:1146
throw err;
^
Error: Cannot find module 'PROJECT_FOLDER\node_modules\hasura-cli\dist\index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
at Module._load (node:internal/modules/cjs/loader:984:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.12.0
As I use NVM for managing node versions, I've tried both node 18 and 20. I've also tried to install hasura-cli globally, but received the same error.
Looks like the maintainers of the package have a build error which means the dist
folder is not being placed into the NPM package.
The solution is to roll back to a version that has been built correctly, 2.36.1 for example:
npm install [email protected].
You can follow along on the GitHub issue tracking this here: https://github.com/jjangga0214/hasura-cli/issues/116
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With