Closed tirthaguha closed 3 years ago
Not sure if this will help, but I've found that nodemon
doesn't work on WSL2 either. However, webpack-dev-server, bundled with create-react-app boilerplates or otherwise, seems to work fine.
It's not clear what "doesn't run" mean. Is there any error message? Your description looks like it does run, but it does not update/hot-reload, which is a different problem.
Please try the same with canary https://docusaurus.io/community/canary Make sure you don't use any symlink
I don't have Windows / WSL2 so it's unlikely I'll be able to work on this myself anytime soon, help from the community wanted
Not sure if this will help, but here are the logs.
$ npm start
> pages@0.0.0 start /path/path/pages
> docusaurus start
Starting the development server...
Docusaurus website is running at "http://localhost:3000/pages/".
✔ Client
Compiled successfully in 57.72s
ℹ 「wds」: Project is running at http://localhost:3000/
ℹ 「wds」: webpack output is served from /pages/
ℹ 「wds」: Content not from webpack is served from /path/path/pages
ℹ 「wds」: 404s will fallback to /index.html
● Client █████████████████████████ done (99%) plugins
WebpackDevMiddleware
Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/f/pagefile.sys'
For sure it helps, how can we help if we don't even know the error message?
Error: EACCES: permission denied
This might be a problem on your system (in case you abuse usage of sudo or have permissions not configured correctly). For now I'm going to close this issue. If you/someone else can reproduce it on another Windows/WSL2 computer, we'll re-open as it would be a proof it's not a problem on your specific computer.
I found these threads https://github.com/h-yoshikawa44/portfolio/issues/10
I don't think this issue should be closed. Although not an issue with this repo, but it certainly is an issue with one of its dependencies. You should wait till the original issue with Watchpack is closed. https://github.com/webpack/watchpack/issues/187
Ok let's re-open then but there's probably not much I can do to solve it
@tirthaguha I think it is bad idea to keep project files in Windows file system (especially node_modules
folder which contains tens of thousands of files) and run node
in WSL2. Even if your permission error is solved, the cross system file access would be extremely slow giving bad development experience. How about you move your project directory inside WSL2 filesystem?
# copy between file systems without node_modules (later install npm packages)
rsync -r /mnt/f/my_website/ --exclude node_modules --delete ~/my_website
cd ~/my_website
npm install
# you can even open your project folder in Windows VS Code
code .
Now it should work as you would expect.
@tirthaguha I agree with the suggestion from @pranabdas. It seems like you installed node in the linux filesystem and your Docusaurus project in the windows file system. This is not the intended usage of WSL2 and it is the likely cause of the permission issue and slow performance that you are facing.
Both your tools (e.g. node) and project files (e.g. Docusaurus) should be installed in the same filesystem (the linux filesystem in this case). Please refer to https://docs.microsoft.com/en-us/windows/wsl/setup/environment#file-storage for the best practices of using WSL2. Here's the relevant section for your current issue:
thanks
Let's close this now and hopefully the problem will be solved with the above advices
🐛 Doesn't run on WSL2 on Ubuntu 20.x
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
(A clear and concise description of what the bug is.)
Have you read the Contributing Guidelines on issues?
Yes
Steps to reproduce
(Write your steps here:)
Unsing npm, not yarn.
Expected behavior
Should work, as it works in windows
Actual behavior
Obviously broken.
Your environment
@docusaurus/core: 2.0.0-beta.2
Rest mentioned in the prerequisites
Reproducible demo
:-(