question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parcel 2 - asset not found

See original GitHub issue

🐛 bug report

With a cold build, everything completes fine. Rerunning with a warm cache causes Parcel to fail with “asset not found” during the bundling phase. These assets do exist at their asset.filePath, so the path is correct.

Error: Asset not found
    at BundleGraph.getDependencies (@parcel/core/lib/BundleGraph.js:257:13)
    at BundleGraph.getDependencies (@parcel/core/lib/public/BundleGraph.js:91:48)
    at @parcel/reporter-hmr-server/lib/HMRServer.js:98:44
    at Array.map (<anonymous>)
    at HMRServer.emitUpdate (@parcel/reporter-hmr-server/lib/HMRServer.js:97:50)

🎛 babel.config.js

module.exports = function(api) {
  api.cache(true)
  const babelConfig = {
    presets: [
      [
        '@babel/env',
        {
          targets: { chrome: '58', ie: '11' },
          modules: 'commonjs',
          useBuiltIns: 'usage',
          corejs: 3,
        },
      ],
      '@babel/preset-typescript',
    ],
    plugins: [
      'babel-plugin-add-module-exports',
      'babel-plugin-transform-dynamic-import',
      'angularjs-annotate',
      'dynamic-import-node',
      '@babel/plugin-proposal-class-properties',
      '@babel/plugin-transform-async-to-generator',
      ['@babel/plugin-transform-runtime', { regenerator: false }],
    ],
    compact: false,
    inputSourceMap: true,
    sourceMaps: true,
  }
  return babelConfig
}

💁 Possible Solution

I haven’t dug this far yet. I need to check the nodes Map in Graph to see if they exist there which might tell me if the asset.id is incorrect.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Cristy94commented, Mar 21, 2020

Related: https://github.com/parcel-bundler/parcel/issues/4356 I get the same error now after updating some packages and reinstalling node_modules.

Error: Asset not found
    at BundleGraph.getDependencies (C:\Users\XCS\AppData\Roaming\npm\node_modules\parcel\node_modules\@parcel\core\lib\BundleGraph.js:184:13)
    at BundleGraph.getDependencies (C:\Users\XCS\AppData\Roaming\npm\node_modules\parcel\node_modules\@parcel\core\lib\public\BundleGraph.js:115:48)
    at Promise.all.changedAssets.map (C:\Users\XCS\AppData\Roaming\npm\node_modules\parcel\node_modules\@parcel\reporter-dev-server\lib\HMRServer.js:79:44)
    at Array.map (<anonymous>)
    at HMRServer.emitUpdate (C:\Users\XCS\AppData\Roaming\npm\node_modules\parcel\node_modules\@parcel\reporter-dev-server\lib\HMRServer.js:78:50)
    at Object.report (C:\Users\XCS\AppData\Roaming\npm\node_modules\parcel\node_modules\@parcel\reporter-dev-server\lib\ServerReporter.js:105:21)
    at ReporterRunner.report (C:\Users\XCS\AppData\Roaming\npm\node_modules\parcel\node_modules\@parcel\core\lib\ReporterRunner.js:77:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Starting parcel with --no-hmr fixes the issue.

0reactions
SA1MAANKHANcommented, Jan 31, 2021

Parcel ran fine after installation but is showing this error when I started it the other day. Any Help Appreciated.

Error: Asset not found
    at BundleGraph.getDependencies (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/core/lib/BundleGraph.js:254:13)
    at BundleGraph.getDependencies (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/core/lib/public/BundleGraph.js:112:48)
    at /home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/reporter-dev-server/lib/HMRServer.js:84:44
    at Array.map (<anonymous>)
    at HMRServer.emitUpdate (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/reporter-dev-server/lib/HMRServer.js:83:50)
    at Object.report (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:125:21)
    at ReporterRunner.report (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/core/lib/ReporterRunner.js:73:31)
    at async Parcel.build (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/core/lib/Parcel.js:383:7)
    at async Parcel.startNextBuild (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/core/lib/Parcel.js:272:21)
    at async PromiseQueue._runFn (/home/salmaan/Documents/GitHub/JavaScript/17-forkify-project/node_modules/@parcel/utils/lib/PromiseQueue.js:98:7)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Assets - Parcel
Parcel is based around assets. An asset can represent any file, but Parcel has special support for certain types of assets like JavaScript,...
Read more >
Importing non-code asset (.png) from Javascript in Parcel 2 ...
Since Parcel bundles without issues, I am assuming this is related to some missing TypeScript configuration. Would you please confirm this?
Read more >
parcel - npm
Out of the box support for JS, CSS, HTML, file assets, and more - no plugins to install. Automatically transforms modules using Babel, ......
Read more >
How to Bundle a Web App with Parcel.js - DigitalOcean
With the Parcel bundler installed as a local dependency, you're now ready to start working on your application. Step 2 — Creating the ......
Read more >
Untitled
Out of the box support for JS, CSS, HTML, file assets, and more - **no plugins to install**. ... or with npm: ```shell...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found