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

Could not serve web with vite #8091

Closed
saw-jan opened this issue Dec 9, 2022 · 4 comments
Closed

Could not serve web with vite #8091

saw-jan opened this issue Dec 9, 2022 · 4 comments

Comments

@saw-jan
Copy link
Member

saw-jan commented Dec 9, 2022

With vite added in PR #7952, commands to serve the web have changed.

Q: Command pnpm serve does the same as pnpm build:w command: builds and watch for file changes. Do we need now serve command (as there are new commands to serve web)?

New commands:
pnpm vite:ocis/pnpm vite: to serve web with oCIS (containerized server)
pnpm vite:oc10: to serve web with oC10 (containerized server)

Both commands fail with this error:

  VITE v4.0.0-beta.5  ready in 652 ms

  ➜  Local:   http://host.docker.internal:8081/
  ➜  Network: http://192.168.0.15:8081/
  ➜  Network: http://172.20.0.1:8081/
  ➜  press h to show help
[vite-plugin-static-copy] Collected 2297 items.
node:internal/errors:478
    ErrorCaptureStackTrace(err);
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/mnt/workspace/owncloud/web/.pnpm-store/v3/files/5d/213f7aec5b222375fda66bfb45762c7f56f7e6eb5c5b55464f45518e2c87f1c0f7c871588edab50ef310bd53ea42ea55fac33a4d671106715e4616dc6bcb0a'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2296:34)
    at createFsWatchInstance (file:///mnt/workspace/owncloud/web/node_modules/.pnpm/vite@4.0.0-beta.5_@types+node@16.18.6/node_modules/vite/dist/node/chunks/dep-4fae821a.js:49627:17)
    at setFsWatchListener (file:///mnt/workspace/owncloud/web/node_modules/.pnpm/vite@4.0.0-beta.5_@types+node@16.18.6/node_modules/vite/dist/node/chunks/dep-4fae821a.js:49674:15)
    at NodeFsHandler._watchWithNodeFs (file:///mnt/workspace/owncloud/web/node_modules/.pnpm/vite@4.0.0-beta.5_@types+node@16.18.6/node_modules/vite/dist/node/chunks/dep-4fae821a.js:49829:14)
    at NodeFsHandler._handleFile (file:///mnt/workspace/owncloud/web/node_modules/.pnpm/vite@4.0.0-beta.5_@types+node@16.18.6/node_modules/vite/dist/node/chunks/dep-4fae821a.js:49893:23)
    at NodeFsHandler._addToNodeFs (file:///mnt/workspace/owncloud/web/node_modules/.pnpm/vite@4.0.0-beta.5_@types+node@16.18.6/node_modules/vite/dist/node/chunks/dep-4fae821a.js:50135:21)
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (file:///mnt/workspace/owncloud/web/node_modules/.pnpm/vite@4.0.0-beta.5_@types+node@16.18.6/node_modules/vite/dist/node/chunks/dep-4fae821a.js:51323:10)
    at NodeFsHandler._addToNodeFs (file:///mnt/workspace/owncloud/web/node_modules/.pnpm/vite@4.0.0-beta.5_@types+node@16.18.6/node_modules/vite/dist/node/chunks/dep-4fae821a.js:50143:18) {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/mnt/workspace/owncloud/web/.pnpm-store/v3/files/5d/213f7aec5b222375fda66bfb45762c7f56f7e6eb5c5b55464f45518e2c87f1c0f7c871588edab50ef310bd53ea42ea55fac33a4d671106715e4616dc6bcb0a',
  filename: '/mnt/workspace/owncloud/web/.pnpm-store/v3/files/5d/213f7aec5b222375fda66bfb45762c7f56f7e6eb5c5b55464f45518e2c87f1c0f7c871588edab50ef310bd53ea42ea55fac33a4d671106715e4616dc6bcb0a'
}
 ELIFECYCLE  Command failed with exit code 1.

I needed to add the following config in vite.config.ts in order to make the commands work.

# vite.config.ts
...
     server: {
       host: 'host.docker.internal',
       strictPort: true
+      watch: {
+         ignored: ['**/.pnpm-store/**']
+      }
     },
...

CC @dschmidt

@dschmidt
Copy link
Member

dschmidt commented Dec 9, 2022

Why is your .pnpm-store in your web folder at all?

But I don't mind, feel free to send this change as a PR, but maybe add a comment that it's not recommended to have the folder in the project.

Is it in .gitignore? I'd expect vite to ignore it then anyway..

@dschmidt
Copy link
Member

dschmidt commented Dec 9, 2022

pnpm serve is probaly broken (and was so before) maybe, we should remove it or just use it aslan alias for pnpm vite

@saw-jan
Copy link
Member Author

saw-jan commented Dec 9, 2022

Why is your .pnpm-store in your web folder at all?

I think I did pnpm config set store-dir ./.pnpm-store earlier. That's the reason the .pnpm-store is in the web dir.

Is it in .gitignore? I'd expect vite to ignore it then anyway.

.pnpm-store is git ignored. I guess vite doesn't consider .gitignore

But I don't mind, feel free to send this change as a PR, but maybe add a comment that it's not recommended to have the folder in the project.

Since I am the only one having this issue, I do not feel confident to send the PR for this. You guys can decide 😄

@saw-jan
Copy link
Member Author

saw-jan commented Dec 13, 2022

I will close it here
Thanks ❤️

@saw-jan saw-jan closed this as completed Dec 13, 2022
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