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

postinstall script in 12.17.2 broken #27384

Closed
slikts opened this issue Jul 25, 2023 · 6 comments
Closed

postinstall script in 12.17.2 broken #27384

slikts opened this issue Jul 25, 2023 · 6 comments
Labels
topic: installation Issue during installation or downloading Cypress

Comments

@slikts
Copy link

slikts commented Jul 25, 2023

Current behavior

Can't install 12.17.2, but 12.17.1 works.

Debug logs

# This file contains the result of Yarn building a package (cypress@npm:12.17.2)
# Script name: postinstall

/home/slikts/.cache/Cypress/12.17.2/Cypress/resources/app/package.json: Unexpected end of JSON input
npm ERR! code 1
npm ERR! path /home/slikts/work/satoir/node_modules/cypress
npm ERR! command failed
npm ERR! command sh -c node index.js --exec install
npm ERR! /home/slikts/.cache/Cypress/12.17.2/Cypress/resources/app/package.json: Unexpected end of JSON input

npm ERR! A complete log of this run can be found in: /home/slikts/.npm/_logs/2023-07-25T14_05_58_015Z-debug-0.log


### Cypress Version

12.17.2

### Node version

16.20.1

### Package Manager

yarn

### Package Manager Version

3.6.0

### Operating system

Linux

### Operating System Version

-

### Other

_No response_
@slikts slikts added the topic: installation Issue during installation or downloading Cypress label Jul 25, 2023
@MikeMcC399
Copy link
Contributor

@slikts

Try

yarn cypress install --force

If that does not work, can you provide your package.json and .yarnrc.yml files?

@slikts
Copy link
Author

slikts commented Jul 25, 2023

The same happens in a newly created package as well (with yarn init or npm init), so there's nothing special about my Yarn config or package.json.

❯ yarn --version
3.6.0-git.20230603.hash-3c8237cb

❯ node --version
v20.5.0

❯ yarn init -y
{
  name: 'cypress-test'
}

❯ yarn add cypress
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 1s 126ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ wrap-ansi@npm:6.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrap-ansi@npm:7.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrappy@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yauzl@npm:2.10.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 0s 298ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ cypress@npm:12.17.2 must be built because it never has been before or the last one failed
➤ YN0009: │ cypress@npm:12.17.2 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-46bfe7a0/build.log)
➤ YN0000: └ Completed in 1s 359ms
➤ YN0000: Failed with errors in 2s 796ms

❯ yarn cypress install --force
/home/slikts/.cache/Cypress/12.17.2/Cypress/resources/app/package.json: Unexpected end of JSON input

❯ yarn add cypress@12.17.1
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ cypress@npm:12.17.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0019: │ cypress-npm-12.17.2-2f269f28b0-19144db1fe.zip appears to be unused - removing
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ cypress@npm:12.17.1 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 278ms
➤ YN0000: Done with warnings in 1s 570ms

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 25, 2023

@slikts

Thanks for your logs. Here's what happened why I ran this on Ubuntu 22.04.2 LTS:

yarn --version
3.6.0

node --version
v20.5.0

yarn init -y
{
  name: 'cypress-test',
  packageManager: 'yarn@3.6.0'
}

yarn add cypress
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 3s 185ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ wrap-ansi@npm:6.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrap-ansi@npm:7.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrappy@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yauzl@npm:2.10.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 0s 669ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ cypress@npm:12.17.2 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 321ms
➤ YN0000: Done with warnings in 5s 199ms
  • Which Linux are you using?
  • Do you know why your yarn --version is showing a different text 3.6.0-git.20230603.hash-3c8237cb to mine 3.6.0?
  • What does your .yarnrc.yml look like?

@MikeMcC399
Copy link
Contributor

@slikts

Please check that you are using an official release of Yarn Modern:

yarn set version 3.6.0

or

yarn set version berry

@slikts
Copy link
Author

slikts commented Jul 26, 2023

Same issue happens with npm:

❯ npm i cypress
npm ERR! code 1
npm ERR! path /c/work/cypress-test2/node_modules/cypress
npm ERR! command failed
npm ERR! command sh -c node index.js --exec install
npm ERR! /home/slikts/.cache/Cypress/12.17.2/Cypress/resources/app/package.json: Unexpected end of JSON input

npm ERR! A complete log of this run can be found in: /home/slikts/.npm/_logs/2023-07-26T06_44_59_083Z-debug-0.log

I fixed it by doing this:

rm -rf ~/.cache/Cypress

@slikts slikts closed this as completed Jul 26, 2023
@MikeMcC399
Copy link
Contributor

@slikts

Thanks for posting how you solved the corrupt cache.

yarn cypress cache clear

may also have solved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: installation Issue during installation or downloading Cypress
Projects
None yet
Development

No branches or pull requests

2 participants