Berry: [Bug] Deleting lockfile causes assertion to fail

Created on 25 Jan 2020  Â·  5Comments  Â·  Source: yarnpkg/berry

  • [ ] I'd be willing to implement a fix

Deleting a lockfile causes:

D:\dev\projectname>yarn
Internal Error: Assertion failed: The package should have been detected as part of the project
    at Function.find (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:36:574360)
    at async c.execute (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:58:22393)
    at async c.validateAndExecute (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:24:40434)
    at async c.run (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:36:533800)
    at async c.runExit (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:36:533934)

The missing lockfile was a valid scenario in Yarn v1, the lockfile was properly regenerated.

Creating empty yarn.lock causes different kind of issue.

➤ YN0000: ┌ Resolution step
➤ YN0032: │ sharp@npm:0.23.4: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ nan@npm:2.14.0: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ nan@npm:2.14.0: Implicit dependencies on node-gyp are discouraged
➤ YN0001: │ Error: graphql@^14.0.0 | ^15.0.0-rc.1 isn't supported by any available resolver
    at t.MultiResolver.getResolverByDescriptor (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:24:41628)
    at t.MultiResolver.bindDescriptor (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:24:41082)
    at t.OverrideResolver.bindDescriptor (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:36:862333)
    at C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:36:583324
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 254)
    at async N.resolveEverything (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:36:582677)
    at async C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:36:599416
    at async l.startTimerPromise (C:\Users\Andrew\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js:24:45528)
➤ YN0000: └ Completed in 13.87s
➤ YN0000: Failed with errors in 13.89s

Feels like NPM Semver resolver is malfunctioning on empty lockfiles. Lockfile is not updated/regenerated with what it succeeded to resolve before failure.

  • OS: Windows 10
  • Node version v13.6.0
  • Yarn version 2.0.0-rc.27
bug

All 5 comments

Can you check whether you have a lockfile higher up in your filesystem hierarchy? For example in /home or /tmp, depending on your setup?

@arcanis Indeed I had (unexpectedly, to be honest). Unfortunately, I've already reverted to legacy Yarn due to #752, so checking this might take time (a couple of days).

No worry - also note that ^14.0.0 | ^15.0.0-rc.1 is not a valid semver range. It should be ||.

I'll close this issue but also look improving the first error message you got.

Also encountered this due to a spurious yarn.lock in my home directory. Probably ended up there due to opening a new terminal window and typing yarn thinking I was in my project directory. Might be a common thing for users to have.

I've moved back to npm install until this is resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juanpicado picture juanpicado  Â·  4Comments

danreg picture danreg  Â·  3Comments

Mike-Dax picture Mike-Dax  Â·  3Comments

bradleyayers picture bradleyayers  Â·  3Comments

janicduplessis picture janicduplessis  Â·  4Comments