Running project
geakstr opened this issue · 9 comments
Hello! I don't understand how to run project with profile. I did
gradle -Dspring.profiles.active=webpack,fake-redis bootRun
but http://localhost:3000 not found. gradle frontend:start
and gradle backend:bootRun
works
Ran into the same problem. not quite sure how to cope with the js issue. mine goes like this:
.../frontend$ ../gradlew start
.............
.............
ERROR in ./src/config/router.js
Module not found: Error: Cannot resolve module 'isDev' in .../frontend/src/config
@ ./src/config/router.js 57:13-29
ERROR in ./src/config/store.js
Module not found: Error: Cannot resolve module 'isDev' in .../frontend/src/config
@ ./src/config/store.js 23:13-29
any hints appreciated. cheers
Hey guys! Thanks for the feedback.
isDev
is a node module, it should be installed in frontend/node_modules.
If you have npm installed, could you please use npm start
in the frontend directory instead of relying on the webpack
profile?
Also, what OS are you using?
I updated the node version used in the gradle node plugin but forgot to update it here:
It should say 5.0.0.
To be honest, the WebpackLauncher is a bit fragile. I should probably remove it and promote the use of npm instead.
Another thing is you have to run gradle frontend:npmInstall
or go in the frontend dir and type npm install
before trying to run the frontend.
Last word in favor of running npm start
instead of using the webpack
profile:
the output of the two processes will be cleanly separated. It is easier to see errors that way.
You can also restart one without touching the other, which is a big plus IMHO but I'd love to hear your thoughts and suggestions.
And finally @geakstr, properties you pass to gradle are not passed over to spring so -Dspring.profiles.active will not work this way.
See spring-projects/spring-boot#832 and http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html
Hi! thanks for the response. Maybe I wasn't too specific.
I did try npm install too altogether with npm start but I ran into this exception
app.use('/api', (req, res) => {
^^
SyntaxError: Unexpected token =>
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
figure I might be using old nodejs? will try to upgrade... and let you know then.
I love the idea of your seed project btw!
@millun Yes! The arrow notation for functions is for node 4.0.0+.
Guys, I pushed a new branch where the problem is fixed:
https://github.com/geowarin/boot-react/blob/210fb2f39cf0e393e82a267a85a34facd79a4795/backend/src/main/groovy/react/config/webpack/WebpackLauncher.groovy
but I find the code difficult to understand...
Just some comment about this problem:
ERROR in ./src/config/router.js
Module not found: Error: Cannot resolve module 'isDev' in .../frontend/src/config
@ ./src/config/router.js 57:13-29
I'm not sure if this is a platform (I'm on Ubuntu) problem but i had to rename the module import:
import isDev from 'isDev';
to
import isDev from 'isdev';
@nullsumme You're totally right, that's a bug. I'll fix this ASAP.