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 cache not working under windows #9952

Open
ogsadmin opened this issue Sep 14, 2024 · 0 comments
Open

Parcel cache not working under windows #9952

ogsadmin opened this issue Sep 14, 2024 · 0 comments

Comments

@ogsadmin
Copy link

🐛 bug report

A new install of parcel under windows 11 and trying to build the getting-started code failes with [Error: Error opening directory] (reported twice). Subsequent runs of npx parcel src/index.html fail with error message [Error: Unable to open snapshot file: No such file or directory], so overall it is not possible to use parcel...

After adding the --no-cache flag everything works (workaround found here, so I think this is related to caching (maybe a windows only issue)).

The project path does not contain spaces, the node.js version is the current v20.17.0 LTS version, npm is v10.8.2.

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

{
  "name": "my-project",
  "source": "src/index.html",
  "scripts": {
    "start": "parcel",
    "build": "parcel build"
  },
  "devDependencies": {
    "parcel": "latest"
  }
}

The cli command to run the build I use is npm run start.

🤔 Expected Behavior

Well, not throwing an error and dropping back to command line, but continuing to build/serve.

😯 Current Behavior

The cli command to run the build is npm run start, which failes with:

❯ npm run start
> start
> parcel

Server running at http://localhost:1234
✨ Built in 653ms
[Error: Error opening directory]
[Error: Error opening directory]
❯ 

Subsequent runs of npm run start fail with:

❯ npm run start
> start
> parcel

[Error: Unable to open snapshot file: No such file or directory]
❯ 

💁 Possible Solution

The workaround is to add the --no-cache flag to all parcel commands (workaround found here, so I think this is related to caching (maybe a windows only issue)).

A working package.json is:

{
  "name": "my-project",
  "source": "src/index.html",
  "scripts": {
    "start": "parcel --no-cache",
    "build": "parcel build --no-cache"
  },
  "devDependencies": {
    "parcel": "latest"
  }
}

🔦 Context

I was trying to follow the "getting started" tutorial.

💻 Code Sample

Just follow the "getting started" under Windows 11.

🌍 Your Environment

Software Version(s)
Parcel [email protected]
Node v20.17.0
npm/Yarn 10.8.2
Operating System WIndows 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant