Description
Description
I forked and cloned the maintainermonth
repository on my local machine.
I followed the instructions on the README
to run the project locally. However, I encountered some problems when installing dependencies with yarn
.
Environment
- OS: Windows 11
- Yarn version: v1.22.19
- Node version: v20.17.0
How to reproduce the bug
yarn install
-
Fork and clone the forked
maintainermonth
repository to your local machine. -
Run
yarn install
. -
You will get an error message (the path will be different depending on your directory & folder names):
error An unexpected error occurred: "Unknown token: { line: 1379, col: 1, type: 'INVALID', value: undefined } 1379:1 in D:\\WebDev\\GitHub\\maintainermonth\\yarn.lock".
yarn start
When I could finally install the dependencies, running yarn start
also gave me a problem.
-
Run
yarn start
. -
You will get an error message (the path will be different depending on your directory & folder names):
Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id at setupFsCheck (D:\WebDev\GitHub\maintainermonth\node_modules\next\dist\server\lib\router-utils\filesystem.js:151:19) at async initialize (D:\WebDev\GitHub\maintainermonth\node_modules\next\dist\server\lib\router-server.js:63:23) at async Server.<anonymous> (D:\WebDev\GitHub\maintainermonth\node_modules\next\dist\server\lib\start-server.js:249:36) error Command failed with exit code 1.
yarn build
After running yarn start
, in the error message, it was mentioned: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server.
So, I followed this instruction as the below:
-
Run
yarn build
. -
You will get the error message:
$ NODE_ENV=production next build 'NODE_ENV' is not recognized as an internal or external command, operable program or batch file. error Command failed with exit code 1.
Workaround
I finally could get everything worked as expected with the below workaround:
-
Fork and clone the forked
maintainermonth
repository to the local machine. -
Remove the
yarn.lock
file. -
Run
yarn install
.Now the dependencies can be installed without any issue, and a new
yarn.lock
file is generated. -
Run
yarn dev
.Running
yarn start
still doesn't work. Butyarn dev
runs and renders the website with no problem.
Suggestions
Sometimes, Windows users encounter problems that Mac users don't. It'd be great if other Windows users could confirm if this also happened in their machine.
If they encounter the same problem, we might want to update the instructions on the README to accommodate Windows users.
Things to consider:
- Run
yarn dev
instead ofyarn start
- Recommended
yarn
version if preferable - Recommended Node version if preferable