Skip to content

3.0.0 Global binary cache not used #1813

@Manduro

Description

@Manduro

Is this a Feature or Bug?

🐛

Current behavior:

The Cypress binary is still downloaded every time I run npm install in a project using Cypress 3.

> cypress@3.0.0 postinstall /Users/username/project-path/node_modules/cypress
> node index.js --exec install
  cypress:cli installing Cypress from NPM +0ms
  cypress:cli installing with options {} +0ms
  cypress:cli version in package.json is 3.0.0 +0ms
  cypress:cli no binary installed under cli version +10ms
  cypress:cli checking local file /Users/username/3.0.0 cwd /Users/username/project-path +0ms
  cypress:cli preparing to download and unzip version  3.0.0 to path /Users/username/Library/Caches/Cypress/3.0.0 +1ms
Installing Cypress (version: 3.0.0)

  cypress:cli needed Cypress version: 3.0.0 +0ms
  cypress:cli downloading cypress.zip to "/var/folders/v7/9nx1z89174vcr0cymryv5gm80000gn/T/cypress.zip" +0ms
  cypress:cli Downloading from https://download.cypress.io/desktop/3.0.0?platform=darwin&arch=x64 +1ms
  cypress:cli Saving file to /var/folders/v7/9nx1z89174vcr0cymryv5gm80000gn/T/cypress.zip +0ms
 ⠹  Downloading Cypress    
 ⠸  Downloading Cypress      99% 0s
    Unzipping Cypress      
    Finishing Installation 
 ✔  Downloaded Cypress
 ⠋  Unzipping Cypress      
    Finishing Installation 
 ✔  Downloaded Cypress
 ⠧  Unzipping Cypress        86% 2s
 ✔  Downloaded Cypress
 ✔  Unzipped Cypress
 ✔  Finished Installation /Users/username/Library/Caches/Cypress/3.0.0

You can now open Cypress by running: node_modules/.bin/cypress open

https://on.cypress.io/installing-cypress

The binary is correctly saved to the global cache path, but the existing binary it is not detected on the next install.

Running with additional logging added by me:

DEBUG=cypress:cli node /Users/username/project-path/node_modules/cypress/index.js --exec install
  cypress:cli installing Cypress from NPM +0ms
  cypress:cli installing with options {} +0ms
  cypress:cli version in package.json is 3.0.0 +1ms
cacheDir /Users/username/Library/Caches/Cypress
installDir /Users/username/Library/Caches/Cypress/3.0.0
getBinaryPkgVersionAsync /Users/username/Library/Caches/Cypress/3.0.0
pathToPackageJson /Users/username/Library/Caches/Cypress/3.0.0/Contents/Resources/app/package.json
binaryVersion null
  cypress:cli no binary installed under cli version +10ms
  cypress:cli checking local file /Users/username/3.0.0 cwd /Users/project-path +1ms
  cypress:cli preparing to download and unzip version  3.0.0 to path /Users/username/Library/Caches/Cypress/3.0.0 +0ms
Installing Cypress (version: 3.0.0)

  cypress:cli needed Cypress version: 3.0.0 +0ms
  cypress:cli downloading cypress.zip to "/var/folders/v7/9nx1z89174vcr0cymryv5gm80000gn/T/cypress.zip" +0ms
  cypress:cli Downloading from https://download.cypress.io/desktop/3.0.0?platform=darwin&arch=x64 +1ms
  cypress:cli Saving file to /var/folders/v7/9nx1z89174vcr0cymryv5gm80000gn/T/cypress.zip +0ms

This shows what's going wrong: pathToPackageJson /Users/username/Library/Caches/Cypress/3.0.0/Contents/Resources/app/package.json
should be pathToPackageJson /Users/username/Library/Caches/Cypress/3.0.0/Cypress.app/Contents/Resources/app/package.json

Desired behavior:

"Cypress now caches globally per version which prevents it from being installed multiple times across projects."

Steps to reproduce:

npm install
rm -rf node_modules
npm install
# Check if the binary is redownloaded

Versions

Cypress 3.0.0
Node 8.10
OS X 10.13.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions