Repository navigation
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
maintainermonthrepository 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
maintainermonthrepository to the local machine. -
Remove the
yarn.lockfile. -
Run
yarn install.Now the dependencies can be installed without any issue, and a new
yarn.lockfile is generated. -
Run
yarn dev.Running
yarn startstill doesn't work. Butyarn devruns 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 devinstead ofyarn start - Recommended
yarnversion if preferable - Recommended Node version if preferable
Activity
The-Best-Codes commentedon Apr 21, 2025
Honestly, I would use pnpm (or bun, if you're feeling adventurous) instead of yarn. pnpm and bun have fantastic DX, and yarn is getting a bit slow nowadays. 🥲
But of course, that's up to the team!
TomNaughton commentedon Dec 11, 2025
@chrisreddington Are you using Windows?
I had to install cross-env and update the build script to "cross-env NODE_ENV=production next build".
Then to test I need to run "npm run build", followed by "npx serve@latest out".
andersen00319 commentedon Jan 23, 2026
first, you have to remove yarn.lock and regeneration it.
and install node20 directly.
second, your .env error
Update site for 2026, fix responsive layout, improve README
Fix Windows build, footer icon wrapping on mobile
Update site for 2026, fix responsive layout, improve README
Fix Windows build, footer icon wrapping on mobile
ashleywolf commentedon Mar 24, 2026
Addressed in #380 — added
cross-envand updated the build script fromNODE_ENV=production next buildtocross-env NODE_ENV=production next build, which fixes the'NODE_ENV' is not recognizederror on Windows. README also updated with npm commands and Node.js v20 requirement. Thanks for the detailed write-up and workaround, @adiati98!