Comments (9)
I've just pushed up a fix for the .env
file reading in npm run start
, so I'm closing this one.
@maceq687 That's correct, there's a symlink to the frontend build directory, so you have to make sure that you can see the built frontend including the index.html
file through the symlink. Based on the direction of your backslashes, I assume you're on Windows. You may have to figure out how to make symlinks work when checking out a git repository. If you still have trouble and you believe the issue is in the project, then please open a separate issue from this one to keep things organized!
from dirigera-web.
I've never seen this "Bus error" output from swc. What version of node and npm do you have installed?
from dirigera-web.
domoticz@ns1server:~/dirigera-web$ nvm use node
Now using node v22.2.0 (npm v10.7.0)
domoticz@ns1server:~/dirigera-web$npm install
npm warn deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
prepare
husky
added 1743 packages, and audited 1746 packages in 17s
311 packages are looking for funding
run npm fund
for details
found 0 vulnerabilities
domoticz@ns1server:~/dirigera-web$ npm run build
build
npm run build -ws
build
swc src -d dist --strip-leading-paths
Successfully compiled: 18 files with swc (134.45ms)
build
vite build
vite v5.2.11 building for production...
✓ 1734 modules transformed.
build/registerSW.js 0.14 kB
build/manifest.webmanifest 0.53 kB
build/index.html 0.79 kB │ gzip: 0.45 kB
build/assets/index-Cm_1FYRq.css 2.97 kB │ gzip: 1.19 kB
build/assets/index-DfVdi6X3.js 1,024.26 kB │ gzip: 324.28 kB
(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 9.57s
PWA v0.20.0
mode generateSW
precache 15 entries (1079.92 KiB)
files generated
build/sw.js
build/workbox-464e6d59.js
from dirigera-web.
This looks like you succeeded with the build. 🙂 What was the solution?
from dirigera-web.
this is after the build:
domoticz@ns2server:~/dirigera-web$ npm start
start
npm run start -w backend
start
node dist/index.js
node:internal/modules/cjs/loader:1227
throw err;
^
Error: Cannot find module '/home/domoticz/dirigera-web/backend/dist/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1224:15)
at Module._load (node:internal/modules/cjs/loader:1050:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:168:12)
at node:internal/main/run_main_module:30:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v22.1.0
npm error Lifecycle script start
failed with error:
npm error Error: command failed
npm error in workspace: backend
npm error at location: /home/domoticz/dirigera-web/backend
domoticz@ns2server:~/dirigera-web$
from dirigera-web.
Start again from scratch,
Compile ok.
Run error:
domoticz@ns2server:~/dirigera-web$ npm start
start
npm run start -w backend
start
node dist/index.js
/home/domoticz/dirigera-web/node_modules/@lpgera/ts-env/dist/src/orThrow.js:7
throw new Error(Couldn't read ${type} value from process.env.${key}
);
^
Error: Couldn't read string value from process.env.JWT_SECRET
at /home/domoticz/dirigera-web/node_modules/@lpgera/ts-env/dist/src/orThrow.js:7:19
at exports.default [as stringOrThrow] (/home/domoticz/dirigera-web/node_modules/@lpgera/ts-env/dist/src/stringOrThrow.js:8:78)
at Object. (/home/domoticz/dirigera-web/backend/dist/jwt.js:26:35)
at Module._compile (node:internal/modules/cjs/loader:1434:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
at Module.load (node:internal/modules/cjs/loader:1249:32)
at Module._load (node:internal/modules/cjs/loader:1065:12)
at Module.require (node:internal/modules/cjs/loader:1271:19)
at require (node:internal/modules/helpers:123:16)
at Object. (/home/domoticz/dirigera-web/backend/dist/graphql/definitions/auth.js:21:14)
Node.js v22.2.0
npm error Lifecycle script start
failed with error:
npm error Error: command failed
npm error in workspace: backend
npm error at location: /home/domoticz/dirigera-web/backend
My .env file is (apart from ACCESS_TOKEN the rest is "real"):
GATEWAY_IP=172.16.3.7
ACCESS_TOKEN="MYACCESSTOKEN"
JWT_SECRET=your-random-secret-key
JWT_EXPIRY=7 days
PASSWORD=password
PORT=4000
from dirigera-web.
I'm not using this project without Docker nowadays, so it's likely that the environment variable reading is broken.
Could you try to start it with node --env-file=.env backend/dist/index.js
as a workaround?
from dirigera-web.
This way it works
from dirigera-web.
When trying to run npm start
I've got the same error as #1347 (comment)
When trying to start with node --env-file=.env backend/dist/index.js
I've got:
Server is listening on port 4000
so it look promising, but after opening the http://127.0.0.1:4000/ all I can see is:
Error: ENOENT: no such file or directory, stat '<PROJECT-PATH>\dirigera-web\backend\frontend\index.html'
I had a look at the files and I can see that the <PROJECT-PATH>\dirigera-web\backend\frontend
is a simple redirect:
../frontend/build
and I have the <PROJECT-PATH>\dirigera-web\frontend\build\index.html
file and all the other build files present, so I'm not entirely sure what goes wrong, perhaps I have missed something? 👀
from dirigera-web.
Related Issues (5)
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 dirigera-web.