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

Closed
ogsadmin opened this issue Sep 14, 2024 · 3 comments
Closed

Parcel cache not working under windows #9952

ogsadmin opened this issue Sep 14, 2024 · 3 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 parcel@2.12.0
Node v20.17.0
npm/Yarn 10.8.2
Operating System WIndows 11
@devongovett
Copy link
Member

Are you missing permissions to create a .parcel-cache folder in your project?

@ogsadmin
Copy link
Author

No, I have full control of the project folder, I can see the .parcel-cache folder getting created. Manually deleting the cache folder (running under the same user account) makes the next parcel run work (and the one after it fail again). This is even repeatable with creating a new project in a new folder.

As a side note: I also seem to have troubles with file watching - the watcher seems to crash now and then when I save changes (but this might be related to the VSCode settings - I've read the docs ;-)). So again maybe likely not a parcel issue, but a watcher issue...

@ogsadmin
Copy link
Author

Sorry, I've tried again and was not able to reproduce anymore. I've started a new, clean project and everything works. Went back to the old project (where I had the problems) and also everything works there now.

Sorry for the false report, obviously this was something related to my machine.

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

2 participants