parcel icon indicating copy to clipboard operation
parcel copied to clipboard

Parcel crashes with `Error: ENOENT: no such file or directory,` when using `--detailed-report`

Open danieltroger opened this issue 2 years ago • 35 comments

🐛 bug report

The following command: parcel build --detailed-report 40 src/main.ts makes parcel crash

🎛 Configuration (.babelrc, package.json, cli command)

{
  "devDependencies": {
    "parcel": "nightly"
  },
  "targets": {
    "newest": {
      "engines": {
        "browsers": "last 1 firefox version"
      }
    }
  },
  "scripts": {
    "build": "parcel build --detailed-report 40 src/main.ts"
  }
}

🤔 Expected Behavior

Parcel should build successfully

😯 Current Behavior

[Error: ENOENT: no such file or directory, open '/private/tmp/parcel/dist/main.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/private/tmp/parcel/dist/main.js'
}

💁 Possible Solution

Dunno 🤷‍♂️

🔦 Context

Updated my dependencies to figure out if it fixes https://github.com/babel/babel/issues/14345. After installing process and figuring out that my builds randomly fail because I'm missing

  "alias": {
    "process": {
      "global": "process"
    }
  },

In my package.json I got this error and narrowed it down to --detailed-report

💻 Code Sample

parcel-error.zip

Run yarn install and yarn build

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-nightly.1008+493fda27e
Node v17.6.0
npm/Yarn 3.2.
Operating System macOS 12.2 (21D49)

danieltroger avatar Mar 10 '22 14:03 danieltroger

Got the same Issue on Windows 10, node v17.8.0, npm 8.5.5, parcel 2.4.0 & 2.4.1. I also use --detailed-report --reporter @parcel/reporter-bundle-analyzer

Hint: The build itself works fine, just the error appears instead of a detailed report.

kai-dorschner-twinsity avatar Mar 31 '22 20:03 kai-dorschner-twinsity

The detailed report uses source maps to determine the file sizes of each file contained within a bundle. This could potentially happen if a source map refers to a file that doesn't actually exist. I guess we should check that and gracefully fall back somehow?

devongovett avatar Apr 03 '22 14:04 devongovett

The project is entirely clean though. No old cache files. The development mode works fine. It's just the build that throws an error. I'll try to reproduce it with a demo project and send you the code.

kai-dorschner-twinsity avatar Apr 04 '22 08:04 kai-dorschner-twinsity

@kai-dorschner-twinsity Did you try the reproduction project that I attached as .zip in the original issue body? It might be enough.

danieltroger avatar Apr 05 '22 07:04 danieltroger

This is probably be related to https://github.com/parcel-bundler/parcel/issues/7813#issuecomment-1085012123 if /private/tmp/parcel/dist/main.js isn't fully written to disk yet when the report tries to read it back.

mischnic avatar Apr 05 '22 08:04 mischnic

@kai-dorschner-twinsity Did you try the reproduction project that I attached as .zip in the original issue body? It might be enough.

I tried it now, breaks as expected.

kai-dorschner-twinsity avatar Apr 05 '22 11:04 kai-dorschner-twinsity

Lmao, what??

I just upgraded to 2.0.0-nightly.1035+80c728cef and it appears to be fixed??

It happens on 2.0.0-nightly.1008+493fda27e where the zip file's lockfile is but doesn't happen in my production project anymore which is on 1035 if I don't find further issues.

I tried to upgrade the reproduction but got

daniel@Daniels-MacBook-Pro parcel % yarn install
➤ YN0000: ┌ Resolution step
➤ YN0032: │ @parcel/watcher@npm:2.0.5: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ node-addon-api@npm:3.2.1: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ msgpackr-extract@npm:1.1.0: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ lmdb@npm:2.2.4: Implicit dependencies on node-gyp are discouraged
➤ YN0013: │ node-gyp-build@https://github.com/kriszyp/node-gyp-build.git#commit=c9952cb77e89d2cd8b6c2d4d056a06d41834b305 can't be found in the cache and will be fetched from GitHub
➤ YN0032: │ nan@npm:2.15.0: Implicit dependencies on node-gyp are discouraged
➤ YN0035: │ chownr@npm:^2.0.0: The remote server failed to provide the requested resource
➤ YN0035: │   Response Code: 404 (Not Found)
➤ YN0035: │   Request Method: GET
➤ YN0035: │   Request URL: https://registry.yarnpkg.com/chownr
➤ YN0000: └ Completed in 16s 419ms
➤ YN0000: Failed with errors in 16s 425ms

And don't care about debugging that so it might be fixed or something makes that I don't hit it anymore in my prod repo. Would love to hear what could have fixed it and if you also don't have it anymore on 1035 @kai-dorschner-twinsity

danieltroger avatar Apr 05 '22 12:04 danieltroger

In my project I use Parcel 2.4.1 where the above error appears.

kai-dorschner-twinsity avatar Apr 05 '22 12:04 kai-dorschner-twinsity

Ok and if you set it to 2.0.0-nightly.1035+80c728cef instead of 2.4.1, does it still occur?

danieltroger avatar Apr 05 '22 12:04 danieltroger

Kai, have you checked the reproduction project that I attached as a zip to the original issue? I think it might suffice.

4 apr. 2022 kl. 10:04 skrev Kai Dorschner @.***>:

 The project is entirely clean though. No old cache files. The development mode works fine. It's just the build that throws an error. I'll try to reproduce it with a demo project and send you the code.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

danieltroger avatar Oct 11 '22 08:10 danieltroger

Hi, I often get this error when using parcel watch. During the watch (run with command npx parcel watch --dist-dir ../MyWebApp/wwwroot/SaasScripts --no-cache) , it randomly fails with this error:

image

Sometimes the only solution is to do git clean -fdx and reinstall all npm packages/rebuilt everything, which is very frustrating and time-consuming...

I'm on parcel 2.7.0

mm-dsibinski avatar Oct 11 '22 09:10 mm-dsibinski

Same issue for me. The bigger the code-base gets the worse this problem becomes.

Win 11, Git 2.38.1.windows.1, node v18.11.0, npm 8.19.2, parcel 2.7.0

I'm using workspaces defined as follows:

"workspaces": [
    "src/*"
  ],

This is my start command: parcel serve ./src/app/index.html --log-level info --open --port 5501

Edit: My coworkers can confirm it happens on MacOS, too

Edit 2: This is what we see image

kai-dorschner-twinsity avatar Oct 25 '22 21:10 kai-dorschner-twinsity

Any news on that issue?

remillc avatar Nov 29 '22 18:11 remillc

I've had the same problem for days and can't find a solution. Very frustrating, hardly possible to work normally

alexschmidtuo avatar Dec 02 '22 08:12 alexschmidtuo

Same- I've had this problem too. I feel let down by Parcel- it's very frustrating, and I am not very happy with Parcel. Please, please fix this issue- I can't do anything without constantly rebuilding manually. What's the point of parcel watch if it builds once and throws an error?

IMGROOT2 avatar Dec 19 '22 07:12 IMGROOT2

@IMGROOT2 have you tried removing --detailed-report and using the latest nightly version?

danieltroger avatar Jan 07 '23 11:01 danieltroger

And specifically:

  • if it says syscall: 'open', then this is the right issue. Though this should be fixed now with https://github.com/parcel-bundler/parcel/pull/8194
  • if it says syscall: 'unlink', then it's https://github.com/parcel-bundler/parcel/issues/8615

mischnic avatar Jan 07 '23 11:01 mischnic

if it says syscall: 'unlink', then it's https://github.com/parcel-bundler/parcel/issues/8615

This is my issue. It's quite random, however. Some days, everything will go smoothly, and on other days, it'll crash after building once.

IMGROOT2 avatar Jan 07 '23 18:01 IMGROOT2

Same here!

shbchk avatar Mar 04 '23 15:03 shbchk

Same issue This is my run script: "dev": "tsc --noEmit && parcel src/index.html --no-cache --open"

lexonegit avatar Mar 08 '23 11:03 lexonegit

Same here!

saadazghour avatar Mar 28 '23 02:03 saadazghour

same problem for months now... so annoying

alexschmidtuo avatar May 02 '23 13:05 alexschmidtuo

I have the same issue.

benyrfg avatar Sep 05 '23 19:09 benyrfg

Same issue on Ubuntu, but not on Mac 🤷

herkyl avatar Nov 07 '23 08:11 herkyl

Same problems here on windows that occurs very frequently...

antoine1003 avatar Dec 30 '23 09:12 antoine1003

Same on Windows 11. Using Node.js v20.9.0 and parcel 2.11.0 in a clean project.

node:internal/fs/sync:93
  return binding.unlinkSync(path);
                 ^

Error: ENOENT: no such file or directory, unlink 'C:\...\dist\index.html.41596.1o'
    at Object.unlink (node:internal/fs/sync:93:18)
    at Object.unlinkSync (node:fs:1853:17)
    at WriteStream.<anonymous> (C:\...\node_modules\@parcel\fs\lib\index.js:1024:83)
    at Object.onceWrapper (node:events:629:26)
    at WriteStream.emit (node:events:526:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'unlink',
  path: 'C:\\...\\dist\\index.html.41596.1o'
}

denniscmcom avatar Jan 18 '24 18:01 denniscmcom

Also getting this error on W10. Not sure if it's relevant but I started the project on MacOS where I had zero issues.

olliefwilliams avatar Jan 19 '24 15:01 olliefwilliams

Same here. Errors every few minutes on Windows 11. But with the same project on MacOS, not a single one. For months now..

alexschmidtuo avatar Jan 19 '24 15:01 alexschmidtuo

For me the same on windows 11..

Kacpers avatar Jan 30 '24 09:01 Kacpers

Is this project still alive? A basic feature like watch is not working and this issue is open for a year...

solaristhesun avatar Feb 02 '24 11:02 solaristhesun