Parcel: Unable to build or start new project using Parcel 2

Created on 14 May 2020  ยท  15Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

Attempting to parcel build index.html or parcel index.html fails completely with an ENOENT error.

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

Repro repo is here: https://github.com/AKPWebDesign/parcel-build-issue

๐Ÿค” Expected Behavior

I should be able to build and start my project.

๐Ÿ˜ฏ Current Behavior

I am unable to build and start my project.

Error Details:

yarn run v1.22.4
$ parcel index.html
โ„น๏ธ Server running at http://localhost:1234
Bundling...
Packaging index.html...
Optimizing index.html...
@parcel/workers: ENOENT: no such file or directory, rename '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob.6767.1.0' -> '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob'
Error: ENOENT: no such file or directory, rename '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob.6767.1.0' -> '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob'
    at Object.renameSync (fs.js:660:3)
    at WriteStream.<anonymous> (/AKPWebDesign/parcel-build-issue/node_modules/@parcel/fs/lib/NodeFS.js:74:42)
    at WriteStream.emit (events.js:321:20)
    at emitCloseNT (internal/streams/destroy.js:69:8)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
Packaging index.html...
Optimizing index.html...
@parcel/workers: ENOENT: no such file or directory, rename '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob.6767.2.0' -> '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob'
Error: ENOENT: no such file or directory, rename '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob.6767.2.0' -> '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob'
    at Object.renameSync (fs.js:660:3)
    at WriteStream.<anonymous> (/AKPWebDesign/parcel-build-issue/node_modules/@parcel/fs/lib/NodeFS.js:74:42)
    at WriteStream.emit (events.js:321:20)
    at emitCloseNT (internal/streams/destroy.js:69:8)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
Packaging index.html...
Optimizing index.html...
@parcel/workers: ENOENT: no such file or directory, rename '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob.6767.3.0' -> '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob'
Error: ENOENT: no such file or directory, rename '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob.6767.3.0' -> '/AKPWebDesign/parcel-build-issue/.parcel-cache/c2/28ddc1749b7d8aa1ce360162a8804e.blob'
    at Object.renameSync (fs.js:660:3)
    at WriteStream.<anonymous> (/AKPWebDesign/parcel-build-issue/node_modules/@parcel/fs/lib/NodeFS.js:74:42)
    at WriteStream.emit (events.js:321:20)
    at emitCloseNT (internal/streams/destroy.js:69:8)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
Packaging index.html...
Optimizing index.html...

[ repeat ad infinitum... ]

๐Ÿ’ป Code Sample

https://github.com/AKPWebDesign/parcel-build-issue

๐ŸŒ Your Environment

I tested this repo using both parcel@next and parcel@nightly, on both Ubuntu (using Windows Subsystem for Linux) and macOS Catalina, receiving the same error on both.

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | ^2.0.0-alpha.3.2, ^2.0.0-nightly.270
| Node | v12.x
| npm/Yarn | yarn 1.22.4
| Operating System | Ubuntu 18.04.2 LTS (WSL 4.4.0-18362-Microsoft) / macOS Catalina (10.15.3)

Bug โœจ Parcel 2

All 15 comments

Note: I was able to work around this issue because I have another project that is on [email protected]. Copying that project's yarn.lock over and setting parcel to use that version got my new project building again.

Receiving same issue when deploying to Zeit Vercel (uses yarn). Cannot reproduce locally however (using npm). I'm on Mac OS

I have the same problem in iOS, if I run "parcel index.html" it runs fine, but if I do it through yarn, it will throw "ENOENT: no such file or directory, rename ..." endlessly.

same issue

@mischnic it looks like its a bug in the @parcle/workers package specifically

@Ethan-Arrowood How so? Do you have more details?
(This might also be related to/the same underlying bug as https://github.com/parcel-bundler/parcel/issues/4495)

It is the package that is throw the error in the logs

I think it's rather because the error bubbled up. @parcel/workers itself doesn't use fs.createWriteStream

Ahh okay my mistake then. And yeah it does look similar to the one you linked. Do you know which version I should use for now until this is resolved? I unfortunately do not have a previously working lock file to revert back to as im working with a fairly new project

The function that fails renames a file to make createWriteStream atomic and was added in it's current form in https://github.com/parcel-bundler/parcel/commit/e75bad2ff98eea4a02290bd74d71d1f77131e68e, so it's not in alpha-3.2 (parcel@next).

So there is literally no way for this error to occur with the latest alpha.

previously working lock file

@AKPWebDesign Can you share these two lockfiles + package.jsons? Are you sure this is actually happening with alpha3.2? (And I still can't reproduce this on macOS...)

@mischnic When I install alpha-3.2, I'm seeing it use some nightly packages as well. It seems like @parcel/core@^2.0.0-alpha.3.2 is being resolved to @2.0.0-nightly.270, at least when I install on my machine (with no yarn.lock existing beforehand). I put together a repo here https://github.com/AKPWebDesign/parcel-build-error-repro-cases with what I'm seeing in each case.

Ah, sorry, I remember now. We didn't pin the versions, this will resolve properly in the next release.

Is 2.0.0-nightly.268 working for you? According to your repo the next nightly 2.0.0-nightly.272 is broken. If that's the case https://github.com/parcel-bundler/parcel/pull/4552 might be the culprit.
On my machine, each of your three cases works fine..

So as a workaround: install parcel@next, then in the lockfile replace all Parcel related occurrences of nightly.XYZ with alpha.3.2 and rerun npm/yarn...

Yeah, looks like installing [email protected] (the next oldest parcel version that yarn shows me) resolves this.

Interesting to know that all three are working on your machine... I thought at first that it could be an issue with WSL, but then I tried on macOS and encountered the same problem.

I had the same issue. With the mentioned change in #4552 the close event can get fired twice, therefore the second rename fails. I created a PR which fixes it for me.

Node: v12.16.1
Parcel: ^2.0.0-alpha.3.2
OS: Windows 10

Running: parcel build ./src/roleta.js

@parcel/workers: ENOENT: no such file or directory, rename 'D:DEVroleta.parcel-cachee518c077fa3cde0c05fdc50e47c5833a.blob.12188.3.0' -> 'D:DEVroleta.parcel-cachee518c077fa3cde0c05fdc50e47c5833a.blob'
Error: ENOENT: no such file or directory, rename 'D:\DEV\roleta\.parcel-cache\e5\18c077fa3cde0c05fdc50e47c5833a.blob.12188.3.0' -> 'D:\DEV\roleta\.parcel-cache\e5\18c077fa3cde0c05fdc50e47c5833a.blob'
    at Object.renameSync (fs.js:660:3)
    at WriteStream.<anonymous> (D:\DEV\roleta\node_modules\@parcel\fs\lib\NodeFS.js:74:42)
    at WriteStream.emit (events.js:311:20)
    at emitCloseNT (internal/streams/destroy.js:69:8)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
| Building styles.css...

and it keeps going forever...

You can see that the backslashes are removed.

Was this page helpful?
0 / 5 - 0 ratings