parcel-bundler / parcel

The zero configuration build tool for the web. πŸ“¦πŸš€
https://parceljs.org
MIT License
43.32k stars 2.25k forks source link

parcel watch error: Expected content key 2d39cdf7c618ab5b to exist #8874

Open ted-palmer opened 1 year ago

ted-palmer commented 1 year ago

πŸ› bug report

When running parcel watch 'packages/*' --no-cache I'm getting the following errors:

Error: Expected content key 2d39cdf7c618ab5b to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039.run (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33567:81)
    at $7728b866c345490a$export$2e2bcd8739ae039.emitUpdate (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17210:34) {
  framesToPop: 1
}
Error: Expected content key 2d39cdf7c618ab5b to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039.run (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33567:81)
    at $7728b866c345490a$export$2e2bcd8739ae039.emitUpdate (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17210:34) {
  framesToPop: 1
}
Error: Expected content key 2b62a9a42f419169 to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039.run (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33567:81)
    at $7728b866c345490a$export$2e2bcd8739ae039.emitUpdate (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17210:34) {
  framesToPop: 1
}
Error: Expected content key a628082bff6583f1 to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33573:38)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  framesToPop: 1
✨ Built in 6.89s

Running parcel build 'packages/*' --no-cache builds fine with no errors.

Downgrading to parcel 2.8.2 didn't fix this, as suggested in #8787

Deleting .parcel-cache also didn't work.

πŸŽ› Configuration (.babelrc, package.json, cli command)

{
  "devDependencies": {
    "@parcel/optimizer-data-url": "2.8.2",
    "@parcel/packager-ts": "2.8.2",
    "@parcel/transformer-inline-string": "2.8.2",
    "@parcel/transformer-typescript-tsc": "2.8.2",
    "@parcel/transformer-typescript-types": "2.8.2",
    "@types/node": "^17.0.10",
    "@types/react": "^18.0.15",
    "@types/react-dom": "^18.0.6",
    "buffer": "^6.0.3",
    "ethers": "^5.6.9",
    "gitlog": "^4.0.4",
    "parcel": "2.8.2",
    "prettier": "^2.5.1",
    "process": "^0.11.10",
    "replace-in-files": "^3.0.0",
    "typescript": "^4.9.4"
  },
}

πŸ€” Expected Behavior

Running parcel watch 'packages/*' --no-cache should build with no errors, just as parcel build 'packages/*' --no-cache does.

😯 Current Behavior

Seeing the errors mentioned above.

πŸ’ Possible Solution

Update: adding the --no-hmr parameter to parcel watch made the errors go away

πŸ”¦ Context

πŸ’» Code Sample

Here is the repo where I am running into this issue: https://github.com/reservoirprotocol/reservoir-kit/tree/ted/upgrade-typescript-solution

🌍 Your Environment

Software Version(s)
Parcel 2.8.3 and 2.8.2
Node
npm/Yarn
Operating System macOS Ventura 13.1
cyrusdean commented 1 year ago

I'm also experiencing this issue, but it's also on my build. At first I noticed it when building my Docker image but not locally. After clearing my package-lock and installing the latest version it began happening locally as well.

I've also tried 2.8.2 and same result.

When I tried to revert back to the version I was using, 2.7.0, I started getting a new error:

@parcel/workers: Expected constructor 2.7.0:BundleGraph to be registered with serializer to deserialize

I've yet to find a way around this issue.

EDIT:

Just now found a way around it. I reverted to 2.7.0 again and found where the error in reverting before was. I hadn't explicitly installed @parcel/core at 2.7.0. Adding that to the dependencies, matching parcel and @parcel/transformer-sass my build functions again.

ted-palmer commented 1 year ago

Update: I also hadn't explicitly installed @parcel/core, however, that didn't fix the issue for me. After a lot of testing I discovered that adding the --no-hmr parameter to parcel watch made the errors go away

vinayadiga7 commented 1 year ago

For me it worked when I deleted the .parcel-cache and dist folders completely in the root directory and did the rebuild.

rcramh commented 1 year ago

delete the .parcel-cache folder, then try running command again, it'll work.

nitukumari34 commented 1 year ago

error: Expected content key de1e4a02ec63c4eb to exist This error occurs in parcel version 2.9.2 . then I downgrade the parcel version into 2.7.0 and then error resolved .

taofeek-ob commented 1 year ago

delete the .parcel-cache folder, then try running command again, it'll work.

This fixed it for me.

akanandhu commented 1 year ago

delete the .parcel-cache folder, then try running command again, it'll work.

This worked for me

Harshitbansal637 commented 1 year ago

Same error occurred to me in parcel version - 2.9.3 Solution that worked for me - clear the parcel cache (rm -rf .parcel-cache) and run the application again.

rajatrawal commented 1 year ago

then

this worked for me

NiteshJ1998 commented 1 year ago

delete the .parcel-cache folder, then try running command again, it'll work.

This worked for me . Thank you

nitrathod commented 1 year ago

I just deleted the .parcel-cache and dist folders completely from the root directory and rebuild the applicate, it did worked for me

RuquiaAlam commented 1 year ago

error: Expected content key de1e4a02ec63c4eb to exist This error occurs in parcel version 2.9.2 . then I downgrade the parcel version into 2.7.0 and then error resolved .

this helped me..thanks

thedevbek commented 1 year ago

Thanks, I deleted both the dist and cache, and now it works. It accidentally deleted the dist first so you probably won't have to. But thanks for the solution. I haven't worked with a dist before so appreciate your post.

Subha8371 commented 1 year ago

delete the .parcel-cache folder, then try running command again, it'll work.

its working✨

Rashid004 commented 12 months ago

Error: Expected content key de1e4a02ec63c4eb to exist

Error: Expected content key de1e4a02ec63c4eb to exist at nullthrows (C:\Users\Ansari Rashid\Desktop\starter\node_modules\nullthrows\nullthrows.js:7:15) at AssetGraph.getNodeIdByContentKey (C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\graph\lib\ContentGraph.js:67:38) at C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\core\lib\SymbolPropagation.js:52:82 at Array.map () at propagateSymbols (C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\core\lib\SymbolPropagation.js:52:61) at AssetGraphBuilder.build (C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\core\lib\requests\AssetGraphRequest.js:168:62) at async Object.run (C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\core\lib\requests\AssetGraphRequest.js:60:37)
at async RequestTracker.runRequest (C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\core\lib\RequestTracker.js:633:20) at async Object.run (C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\core\lib\requests\BundleGraphRequest.js:103:11) at async RequestTracker.runRequest (C:\Users\Ansari Rashid\Desktop\starter\node_modules\@parcel\core\lib\RequestTracker.js:633:20)

ColloKaris commented 11 months ago

This worked for me. Thank you

KeshavTandon commented 11 months ago

Error: Expected content key de1e4a02ec63c4eb to exist

Error: Expected content key de1e4a02ec63c4eb to exist at nullthrows (C:\Users\Ansari Rashid\Desktop\starter\node_modules\nullthrows\nullthrows.js:7:15) at AssetGraph.getNodeIdByContentKey (C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\graph\lib\ContentGraph.js:67:38) at C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\core\lib\SymbolPropagation.js:52:82 at Array.map () at propagateSymbols (C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\core\lib\SymbolPropagation.js:52:61) at AssetGraphBuilder.build (C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\core\lib\requests\AssetGraphRequest.js:168:62) at async Object.run (C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\core\lib\requests\AssetGraphRequest.js:60:37) at async RequestTracker.runRequest (C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\core\lib\RequestTracker.js:633:20) at async Object.run (C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\core\lib\requests\BundleGraphRequest.js:103:11) at async RequestTracker.runRequest (C:\Users\Ansari Rashid\Desktop\starter\node_modules@parcel\core\lib\RequestTracker.js:633:20)

I am getting the same error

Steve-1993 commented 10 months ago

delete the .parcel-cache folder, then try running command again, it'll work.

This worked for me too. Thank you

jason-murray commented 10 months ago

Deleting .parcel-cache works for me until I change the HTML node structure in any way, then the problem returns. I'm changing elements all the time so this fix isn't really valid for me. Anyone else got this?

AkashBharti97 commented 10 months ago

delete the .parcel-cache folder, then try running command again, it'll work.

It work for me .

JINESH-742203970 commented 10 months ago

delete the .parcel-cache folder, then try running command again, it'll work.

Yeah,after deleting .parcel-cache folder and run command again .It's working for me

Rashid004 commented 9 months ago

Nice

ARyaskov commented 8 months ago

Right, deleting of .parcel-cache did a trick. If you are using monorepos pls delete a top-level .parcel-cache, not into /packages/your-package/.

SodiqSWE commented 8 months ago

delete the .parcel-cache folder, then try running command again, it'll work.

Yep, this did it for me as well!

0xchikku commented 7 months ago

For me it worked when I deleted the .parcel-cache and dist folders completely in the root directory and did the rebuild.

Worked for me, using parcel version 2.10.3

Revathi-80 commented 7 months ago

folder

yes deleting .parcel-cache worked for me

priyanshukumar001 commented 7 months ago

after closing the server and then deleting the .parcel-cache file and again executing npx parcel

solved the problem!

DerekGray2022 commented 6 months ago

delete the .parcel-cache folder, then try running command again, it'll work.

Stopping the server running then doing this worked for me.

r-rayns commented 5 months ago

Deleting .parcel-cache works for me until I change the HTML node structure in any way, then the problem returns. I'm changing elements all the time so this fix isn't really valid for me. Anyone else got this?

This is what I'm experiencing too. I can edit one of my JavaScript files over and over without this error occurring. I can even edit inside a <script> tag inside a .html document without issue. As soon as I start editing my HTML markup I get this error and have to restart parcel.

pandeyvimal-03 commented 5 months ago

delete parcel-cache and dist folder then restart your using npx parcel index.html

uuf6429 commented 1 month ago

It's been well over a year since this was reported, and there is still no real solution except the half-assed workaround repeatedly mentioned in the previous ~25 useless comments (kudos on that guys /s).

Pulastya12 commented 2 weeks ago

using "rm -rf .parcel-cache" command to remove the "parcel cache" worked for me