Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parcel bundler "ENOENT: no such file or directory" when delete files from project

After I've deleted couple files from project that uses Parcel bundler, command parcel ./index.html started to output following error:

Cannot read property 'type' of undefined
at Bundler.createBundleTree (<project_root>/node_modules/parcel-bundler/src/Bundler.js:654:54)
at Bundler.createBundleTree (<project_root>/node_modules/parcel-bundler/src/Bundler.js:721:12)
at Bundler.createBundleTree (<project_root>/node_modules/parcel-bundler/src/Bundler.js:721:12)
at Bundler.createBundleTree (<project_root>/node_modules/parcel-bundler/src/Bundler.js:721:12)
at Bundler.createBundleTree (<project_root>/node_modules/parcel-bundler/src/Bundler.js:721:12)
at Bundler.createBundleTree (<project_root>/node_modules/parcel-bundler/src/Bundler.js:721:12)
at Bundler.bundle (<project_root>/node_modules/parcel-bundler/src/Bundler.js:298:14)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
like image 858
alaptiko Avatar asked Dec 05 '19 14:12

alaptiko


1 Answers

Solution

Delete .parcel-cache and dist folders and run command again. (NB: The cache folder was called just .cache in version 1.x of Parcel.)

Proposal

Add cleanup script for this and run it each time before parcel build:

 "scripts": {
   "cleanup": "rm -rf .parcel-cache dist",
   "dev": "npm run cleanup && parcel ./index.html",
   ...
 }
like image 190
alaptiko Avatar answered Oct 26 '22 18:10

alaptiko