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

Yarn Optimization is removing dependencies #8230

Open
ryzr opened this issue Jul 13, 2020 · 0 comments
Open

Yarn Optimization is removing dependencies #8230

ryzr opened this issue Jul 13, 2020 · 0 comments

Comments

@ryzr
Copy link

ryzr commented Jul 13, 2020

Bug description

Installing dependencies using a lockfile skips some dependencies and results in broken builds.

Command

➜ vue create test # I created an app with PWA, but should work with default settingscd test
➜ rm -rf node_modules yarn.lock # clean slate
➜ yarn install
➜ yarn build # SUCCEEDS
➜ rm -rf node_modules
➜ yarn install --frozen-lockfile
➜ yarn build
$ vue-cli-service build
internal/modules/cjs/loader.js:1032
  throw err;
  ^

Error: Cannot find module 'normalize-package-data'
Require stack:
- /Users/ryan/Developer/web/test/node_modules/read-pkg/index.js
- /Users/ryan/Developer/web/test/node_modules/@vue/cli-shared-utils/lib/pkg.js
- /Users/ryan/Developer/web/test/node_modules/@vue/cli-shared-utils/index.js
- /Users/ryan/Developer/web/test/node_modules/@vue/cli-service/bin/vue-cli-service.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
    at Function.Module._load (internal/modules/cjs/loader.js:898:27)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at AsyncFunction.module.exports.sync (/Users/ryan/Developer/web/test/node_modules/read-pkg/index.js:37:3)
    at exports.resolvePkg (/Users/ryan/Developer/web/test/node_modules/@vue/cli-shared-utils/lib/pkg.js:7:20)
    at Service.resolvePkg (/Users/ryan/Developer/web/test/node_modules/@vue/cli-service/lib/Service.js:47:17)
    at new Service (/Users/ryan/Developer/web/test/node_modules/@vue/cli-service/lib/Service.js:27:21)
    at Object.<anonymous> (/Users/ryan/Developer/web/test/node_modules/@vue/cli-service/bin/vue-cli-service.js:15:17)
    at Module._compile (internal/modules/cjs/loader.js:1200:30) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/ryan/Developer/web/test/node_modules/read-pkg/index.js',
    '/Users/ryan/Developer/web/test/node_modules/@vue/cli-shared-utils/lib/pkg.js',
    '/Users/ryan/Developer/web/test/node_modules/@vue/cli-shared-utils/index.js',
    '/Users/ryan/Developer/web/test/node_modules/@vue/cli-service/bin/vue-cli-service.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What is the current behavior?
During first installation, the lockfile is created with all necessary dependencies and builds fine.

Installing later on from the lockfile (such as in CI environments), modifies the lockfile, applying some "optimizations" mentioned in #4379. Using the --pure-lockfile or --frozen-lockfile flags prevents the lockfile from being modified, but still does not install all dependencies listed in the lockfile (it skips the ones it wanted to optimize for).

What is the expected behavior?
Installs should be idempotent. If the lockfile has not changed, the install should provide the exact same dependencies on every run.

Steps to Reproduce
See above for example using Vue CLI.

Environment

  • Node Version: 14.4.0
  • Yarn v1 Version: 1.22.4
  • OS and version: Mac OS 10.15.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant