Comments (4)
Looks like it's trying to find an executable at C:\Users\myname\Code\blues-stack-test\node
which is quite odd. Just to confirm something for me though, could you run all these scripts in separate terminals? This will help us make sure this is a pm2 issue.
node --inspect --require .\node_modules\dotenv\config --require .\mocks .\build\server.js
npm run build:server -- --watch
npx remix watch
npm run generate:css -- --watch
Let me know if that works. If so, then we know this is a pm2 issue.
from blues-stack.
Yeah it looks like all 4 scripts are working in separate terminals. In order, here is the output from the terminals in case it is ever relevant:
$ node --inspect --require .\node_modules\dotenv\config --require .\mocks .\build\server.js
Debugger listening on ws://127.0.0.1:9229/dadba26d-186a-4f72-a4c3-2ebfc3f049df
For help, see: https://nodejs.org/en/docs/inspector
� Mock server running
(node:19060) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
� setting up prisma client to localhost:5432
✅ app ready: http://localhost:3000
$ npm run build:server -- --watch
> build:server
> esbuild --platform=node --format=cjs ./server.ts --outdir=build "--watch"
[watch] build finished, watching for changes...
$ npx remix watch
Watching Remix app in development mode...
� Built in 693ms
� File changed: app\styles\tailwind.css
� Rebuilding...
� Rebuilt in 227ms
$ npm run generate:css -- --watch
> generate:css
> tailwindcss -o ./app/styles/tailwind.css "--watch"
Rebuilding...
Done in 286ms.
from blues-stack.
Yeah, so this looks like just a matter of pm2 doing something weird with the node script, but it appears to be fine with npm scripts, so maybe try the latest push I just made where I moved it into an npm script: 89bb536
from blues-stack.
Hi,
I ran into the same issue, it's pm2 related, happens only on Windows and there are no non-hacky solutions it seems. You can read more about the issue here: Unitech/pm2#3657
TL;DR; For some weird reason, pm2 on Windows assumes that whatever you pass to script
inside of the apps
array of your pm2.config.json
is a path to a file, rather than a command (even though it properly supports that same command when you run it as a single command). So my approach is to actually create files for each of those commands and then use shelljs
package to spawn shells which run the actual commands.
I have fixed it by doing the following:
- Change
/other/pm2.config.js
to:
const env = {
NODE_ENV: process.env.NODE_ENV ?? "development",
FORCE_COLOR: "1",
};
module.exports = {
apps: [
{
name: "Server",
script: "./other/server.js",
watch: ["./mocks/**/*.ts", "./build/server.js", "./.env"],
env,
},
{
name: "Server Build",
script: "./other/server-build.js",
ignore_watch: ["."],
env,
},
{
name: "Remix",
script: "./other/remix.js",
ignore_watch: ["."],
env,
},
{
name: "Tailwind",
script: "./other/tailwind.js",
autorestart: false,
ignore_watch: ["."],
env,
},
],
};
- Create
/other/server.js
with the following:
var shell = require("shelljs");
shell.exec("npm run dev:server", { windowsHide: true });
- Create
/other/server-build.js
with the following:
var shell = require("shelljs");
shell.exec("npm run build:server -- --watch", { windowsHide: true });
- Create
/other/remix.js
with the following:
var shell = require("shelljs");
shell.exec("npx remix watch", { windowsHide: true });
- Create
/other/tailwind.js
wit the following:
var shell = require("shelljs");
shell.exec("npm run generate:css -- --watch", { windowsHide: true });
Your npm run dev
should now work as expected.
from blues-stack.
Related Issues (20)
- Wrong http status code (500) returned instead of 404 or any response thrown from a loader. HOT 9
- Hydration error: Initial UI does not match server HOT 3
- New Defer API does not work with blues-stack HOT 11
- When Using Express Adapter Throwing Responses will break the app HOT 1
- great repro
- Race condition in npm run dev HOT 5
- Base Repo OOMs on Fly.io HOT 7
- Fly.io -> Error: Can't reach database server HOT 7
- `npm run typecheck` fails on fresh project HOT 7
- blues-stack 2.0.0-pre.5 - LiveReload is not working HOT 2
- v2_dev leaves one node process behind after shutdown HOT 1
- Scripts variant in README to support the Yarn inclined
- Deployment issue. Node version >18 needed
- Update server.ts to watch version.txt
- Error when trying to run the docker image HOT 3
- Latest server.js code breaks HDR HOT 1
- Some URLs in the `/build` path were 404 not found after making changes in development mode HOT 1
- Vite support
- Build failed while running npm run build on blues stack HOT 2
- Install an esm package dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blues-stack.