We’re using the app router and the @plasmicapp/nextjs-app-router package.
When running following yarn script with-plasmic-prepass -v=true -- next build to extract query data for prerendering - the dev server get’s started correctly, but when the next build commandProcess exits during Linting and checking validity of types due to a typescript / import error, the with-plasmic-prepass scripts tries to kill the dev server, but somehow it fails.
Example when using a non-existent import in the app:
Plasmic: starting prepass dev server at http://localhost:56284 via "npm run dev"...
> website@0.1.0 dev
> cross-env NODE_ENV=development next dev
▲ Next.js 15.1.6
- Local: http://localhost:56284
- Network: http://172.31.112.1:56284
- Environments: .env.local, .env
- Experiments (use with caution):
· staleTimes
✓ Starting...
Plasmic: Dev server started
✓ Ready in 3.9s
Plasmic: Running command: next build
Plasmic: Command running with pid 32392
▲ Next.js 15.1.6
- Environments: .env.local, .env
- Experiments (use with caution):
· staleTimes
Creating an optimized production build ...
Failed to compile.
./src/app/[locale]/[[...catchall]]/page.tsx
Module not found: Can't resolve '@/utils/extract-data'
https://nextjs.org/docs/messages/module-not-found
> Build failed because of webpack errors
Plasmic: Command finished; killing prepass dev server...
Plasmic: Failed to kill dev server: Error: spawn C:\dev\website\node_modules\@plasmicapp\nextjs-app-router\dist\fastlist.exe ENOENT
Therefore the dev server port is still used, some node.exe processes are still left running.
I couldn’t fork the relevant project to try changes locally and create a PR (cannot build and reference the project or I don’t know correctly how to do so).
Yup, we’re running on Windows (Powershell) and other team members get the same error.
I ran your steps. When starting dev server alone and trying to kill via fkill seems to work.
❯ node .\test.js
Process on port 3000 killed
Running them with with-plasmic-prepass starts dev server and then yarn build throws error above when there’s a build error → killing dev server afterwards (when build command exits) fails
Thank you for confirming. Just for clarity, after fkill fails to kill the dev server during with-plasmic-prepass, did you try running the test.js script, replacing 3000 with the dev server port that failed to kill? You can find what port it is running on, by looking at the logs - E.g. in the logs you shared, the port is 56284 (but it will be different every time you run it):
Plasmic: starting prepass dev server at http://localhost:56284 via "npm run dev"...
Also, can you try test.js script with fkill version 8.1.1?
So after running with-plasmic-prepass and trying to kill the hanging dev server by running node .\test.js with fkill@8.1.1 the process gets killed and the port has been released again.
Thank you for your cooperation. Unfortunately, I am unable to reproduce the issue on my end. In the error message:
Failed to kill dev server: Error: spawn C:\dev\website\node_modules\@plasmicapp\nextjs-app-router\dist\fastlist.exe ENOENT
It says that it was unable to spawn a fastlist.exe file. The path is supposed to be C:\dev\website\node_modules\process-exists\node_modules\ps-list\fastlist.exe instead!
Can you check that your node_modules are installed correctly and the process-exists package exists in the node_modules?
Hey @michaelb , could you upgrade to the latest version of loader-nextjs and give it another try on Windows? We’ve recently switched to a different library for shutting down the dev server.