blocks-react-renderer
blocks-react-renderer copied to clipboard
[bug]: Can't install blocks-react-renderer package if husky isn't installed
What version of @strapi/blocks-react-renderer are you using?
- Npm Version: 10.5.2
- Node version: 20.13.1
- React version: 18.3.1
- blocks-react-renderer: 1.0.1
What's Wrong?
Once I do npm install @strapi/blocks-react-renderer react react-dom command inside FE project that doesn't have husky installed as a dependency I get the following error:
npm install @strapi/blocks-react-renderer react react-dom
npm ERR! code 127
npm ERR! path <PATH_TO_THE_FE_PROJECT>/node_modules/@strapi/blocks-react-renderer
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! sh: husky: command not found
npm ERR! A complete log of this run can be found in: <PATH_TO_THE_LOG>
If I do npm install husky --save-dev and run npm install @strapi/blocks-react-renderer react react-dom command again everything is installed correctly.
To Reproduce
Create a new project with vite:
npm create vite@latest demo-project --template react-ts
Navigate to the project directory:
cd demo-project
Run npm install:
npm install
Try to install @strapi/blocks-react-renderer:
npm install @strapi/blocks-react-renderer react react-dom
Expected Behaviour
@strapi/blocks-react-renderer should be installed without having husky as a dev dependency
I faced this issue yesterday, try to do these:
1- Open your terminal and run: npm install -g husky
2- Navigate to your project directory and run: npm install husky --save-dev
3- try again to install the command: npm install @strapi/blocks-react-renderer
I faced this issue yesterday, try to do these:
1- Open your terminal and run:
npm install -g husky2- Navigate to your project directory and run:
npm install husky --save-dev3- try again to install the command:
npm install @strapi/blocks-react-renderer
Yes, I've included that information in my report although the step for installing the husky globally isn't necessary, it's enough to install the husky as a dev dep.
my build on server just fails due to this:
npm error code 127
npm error path /vercel/path0/node_modules/@strapi/blocks-react-renderer
npm error command failed
npm error command sh -c husky install
npm error sh: husky: command not found
npm error A complete log of this run can be found in: /vercel/.npm/_logs/2024-07-31T15_29_19_458Z-debug-0.log
Error: Command "npm install" exited with 127
Hi all, any update on this? I'm experiencing the same problem. Would prefer to not to need to install husky.
This project is using pinst which updates the package.json to _postinstall so the script doesn't run: https://www.npmjs.com/package/@strapi/blocks-react-renderer?activeTab=code
In the package.json it is renamed properly, but npm view @strapi/blocks/react-renderer scripts shows the unrenamed script
techno@TechnoLT:~$ npm view @strapi/blocks-react-renderer scripts
{
lint: 'eslint . --ext .cjs,.js,.ts,.tsx',
test: 'yarn run test:ts && yarn run test:unit',
build: 'pack-up build',
check: 'pack-up check',
watch: 'pack-up watch',
prepack: 'pinst --disable',
'test:ts': 'tsc --noEmit',
'lint:fix': 'yarn lint --fix',
postpack: 'pinst --enable',
'test:unit': 'jest',
postinstall: 'husky install',
prepublishOnly: 'yarn build'
}
techno@TechnoLT:~$
This might've been a bug in npm, so a republish on the latest npm version may fix it
I encountered this problem on version 20 of node, switched to 16 and everything installed without problems
npm install --ignore-scripts @strapi/blocks-react-renderer worked for me, but it's still annoying.
my build on server just fails due to this:
npm error code 127 npm error path /vercel/path0/node_modules/@strapi/blocks-react-renderer npm error command failed npm error command sh -c husky install npm error sh: husky: command not found npm error A complete log of this run can be found in: /vercel/.npm/_logs/2024-07-31T15_29_19_458Z-debug-0.log Error: Command "npm install" exited with 127
DId you get any fix for this? I face the same build error in vercel. I use node 20
my build on server fails
npm error code 127
npm error path /vercel/path0/node_modules/@strapi/blocks-react-renderer
npm error command failed
npm error command sh -c husky install
npm error sh: husky: command not found
npm error A complete log of this run can be found in: /vercel/.npm/_logs/2024-07-31T15_29_19_458Z-debug-0.log
Error: Command "npm install" exited with 127
does anyone have a solution?
I try all above solutions none of them work for me. Try these step to resolve:
- npm install husky --save-dev
- npm install @strapi/blocks-react-renderer --legacy-peer-deps (react & react-dom, dependenies are already installed. So no need again)
Boom it works!
Strapi team should remove this from production builds.
All the methods described above aren't a real solution to the problem. Wasting CPU time on installing unnecessary dependencies and keeping track of their versions is madness.
Still happens.
npm install --ignore-scripts @strapi/blocks-react-renderer works for me.
Agree with @monolithed , we should not have to install husky to fix this bug.
Still happens.
Any news on this ?