Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vsimonovski opened this issue Jun 23, 2024 · 8 comments
Labels
issue: bug Issue reporting a bug

Comments

@vsimonovski
Copy link

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 vsimonovski added the issue: bug Issue reporting a bug label Jun 23, 2024
@MohammedAlez
Copy link

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

@vsimonovski
Copy link
Author

vsimonovski commented Jun 23, 2024

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.

@justAnArthur
Copy link

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

@luca-bitovi
Copy link

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

@Commandtechno
Copy link

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

@soloVlad
Copy link

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

@treasuryspring
Copy link

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

@navamirama
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug
Projects
None yet
Development

No branches or pull requests

8 participants