I'm running fastify on node.js and using Caddy server for reverse proxying localhost to a domain (authsvc.dev
) that serves up an index.html file in this UI project.
All was running fine until a couple days ago. Now, when I run npm run ui
I get the following error messages in the console. The index.html file is not being served up. The src/public/index.html file exists and was working a couple days ago, but maybe some issue with npx serve {{path-to-file}}
? Please help!
ERROR: Not able to read /{{path-to-proj}}/ui/src/public/index.html/serve.json: ENOTDIR: not a directory, open '/{{path-to-proj}}/ui/src/public/index.html/serve.json'
npx serve src/public/index.html exited with code 1
Not sure where or why index.html/serve.json is trying to be read and how to go about fixing it.
I'm running macOs Big Sur v11.6
Some things I've tried.
- Deleting node_modules and
npm install
- Deleting package-lock.json and
npm install
- updating to latest npm
- Changing to different version of node (now on v14.15.1)
- Clearing npm cache
rm -rf ~/.npm
npm clear cache
npx serve src/public/
-- allows me to see when I'm atlocalhost:5000
, but notauthsvc.dev
I do have Caddy running with a reverse proxy set up.
{
local_certs
}
authsvc.dev {
reverse_proxy 127.0.0.1:5000
}
api.authsvc.dev {
reverse_proxy 127.0.0.1:4000
}
Host file
127.0.0.1 authsvc.dev
127.0.0.1 api.authsvc.dev
package.json scripts
"scripts": {
"all": "concurrently \"npm run server\" \"cd ../ui\" \"npm run ui\"",
"server": "cd ../api && npm run start",
"ui": "concurrently \"nodemon src/index.js\" \"npx serve src/public/index.html\"",
"ui1": "nodemon src/index.js",
"ui2": "npx serve src/public/",
"caddy": "caddy run",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watchAll"
},
"dependencies": {
"colors": "^1.4.0",
"concurrently": "^6.2.2",
"cross-fetch": "^3.1.4",
"dotenv": "^10.0.0",
"fastify": "^3.22.0",
"fastify-static": "^4.2.3"
}