blocks-react-renderer icon indicating copy to clipboard operation
blocks-react-renderer copied to clipboard

[bug]: Can't install blocks-react-renderer package if husky isn't installed

Open vsimonovski opened this issue 1 year ago • 13 comments

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

vsimonovski avatar Jun 23 '24 09:06 vsimonovski

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

MohammedAlez avatar Jun 23 '24 09:06 MohammedAlez

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

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.

vsimonovski avatar Jun 23 '24 10:06 vsimonovski

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

justAnArthur avatar Jul 31 '24 19:07 justAnArthur

Hi all, any update on this? I'm experiencing the same problem. Would prefer to not to need to install husky.

luca-bitovi avatar Aug 21 '24 17:08 luca-bitovi

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

Commandtechno avatar Sep 07 '24 04:09 Commandtechno

I encountered this problem on version 20 of node, switched to 16 and everything installed without problems

soloVlad avatar Sep 12 '24 06:09 soloVlad

npm install --ignore-scripts @strapi/blocks-react-renderer worked for me, but it's still annoying.

treasuryspring avatar Oct 21 '24 13:10 treasuryspring

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

navamirama avatar Nov 13 '24 22:11 navamirama

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?

edgesoft-tech avatar Jan 07 '25 15:01 edgesoft-tech

I try all above solutions none of them work for me. Try these step to resolve:

  1. npm install husky --save-dev
  2. npm install @strapi/blocks-react-renderer --legacy-peer-deps (react & react-dom, dependenies are already installed. So no need again)

Boom it works!

mosin92 avatar Jan 16 '25 13:01 mosin92

Strapi team should remove this from production builds.

adityapatadia avatar Feb 27 '25 09:02 adityapatadia

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.

monolithed avatar Mar 22 '25 04:03 monolithed

Still happens. npm install --ignore-scripts @strapi/blocks-react-renderer works for me.

channyeintun avatar May 11 '25 13:05 channyeintun

Agree with @monolithed , we should not have to install husky to fix this bug.

wpiron10 avatar May 21 '25 06:05 wpiron10

Still happens.

Image

bmartin97 avatar Aug 16 '25 19:08 bmartin97

Any news on this ?

le-catalyst avatar Oct 14 '25 05:10 le-catalyst