Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danieltroger opened this issue Mar 10, 2022 · 35 comments

Comments

@danieltroger
Copy link
Contributor

🐛 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 babel/babel#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)
@kai-dorschner-twinsity
Copy link

kai-dorschner-twinsity commented Mar 31, 2022

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.

@devongovett
Copy link
Member

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?

@kai-dorschner-twinsity
Copy link

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.

@danieltroger
Copy link
Contributor Author

danieltroger commented Apr 5, 2022

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

@mischnic
Copy link
Member

mischnic commented Apr 5, 2022

This is probably be related to #7813 (comment) if /private/tmp/parcel/dist/main.js isn't fully written to disk yet when the report tries to read it back.

@kai-dorschner-twinsity
Copy link

@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.

@danieltroger
Copy link
Contributor Author

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

@kai-dorschner-twinsity
Copy link

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

@danieltroger
Copy link
Contributor Author

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

@github-actions github-actions bot added the Stale Inactive issues label Oct 3, 2022
@danieltroger
Copy link
Contributor Author

danieltroger commented Oct 11, 2022 via email

@github-actions github-actions bot removed the Stale Inactive issues label Oct 11, 2022
@mm-dsibinski
Copy link

mm-dsibinski commented Oct 11, 2022

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

@kai-dorschner-twinsity
Copy link

kai-dorschner-twinsity commented Oct 25, 2022

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

@remillc
Copy link

remillc commented Nov 29, 2022

Any news on that issue?

@alexschmidtuo
Copy link

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

@IMGROOT2
Copy link

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?

@danieltroger
Copy link
Contributor Author

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

@mischnic
Copy link
Member

mischnic commented Jan 7, 2023

And specifically:

@IMGROOT2
Copy link

IMGROOT2 commented Jan 7, 2023

if it says syscall: 'unlink', then it's #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.

@shbchk
Copy link

shbchk commented Mar 4, 2023

Same here!

@lexonegit
Copy link

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

@saadazghour
Copy link

Same here!

@alexschmidtuo
Copy link

same problem for months now... so annoying

@benyrfg
Copy link

benyrfg commented Sep 5, 2023

I have the same issue.

@herkyl
Copy link

herkyl commented Nov 7, 2023

Same issue on Ubuntu, but not on Mac 🤷

@antoine1003
Copy link

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

@denniscmcom
Copy link

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'
}

@olliefwilliams
Copy link

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

@alexschmidtuo
Copy link

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

@Kacpers
Copy link

Kacpers commented Jan 30, 2024

For me the same on windows 11..

@solaristhesun
Copy link

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

@tno2007
Copy link

tno2007 commented Feb 13, 2024

Until Parcel can resolve this error, I think Vite is the easiest alternative right now.

@realrolo
Copy link

Sol. on stackoverflow, i had same issue, now works:

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

https://stackoverflow.com/questions/59196917/parcel-bundler-enoent-no-such-file-or-directory-when-delete-files-from-projec

@JJCUBER
Copy link

JJCUBER commented Jun 10, 2024

This is still an issue and happens constantly even when fully disabling cache.

@victoralvelais
Copy link

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

This just helped me, thanks @realrolo

@TechQuery
Copy link

TechQuery commented Jun 23, 2024

I find that bad await import() modules will trigger this bug, but parcel build can exit successfully with no this kind of modules found in dist folder & loaded in Web browser:

Error output

Packaging & Optimizing...
[Error: ENOENT: no such file or directory, open '/my/project/root/../src/page/Example/index.ts'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/my/project/root/../src/page/Example/index.ts'
}
✨ Built in 18.10s

index.ts

await import('./module/with/not/found/modules');
await import('./module/with/default/import/css/modules');

./module/with/not/found/modules.ts

import something from './path/not/found';

./module/with/default/import/css/modules.ts

import style from './index.module.css';
// should be change to
import * as style from './index.module.css';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests