node-packer
node-packer copied to clipboard
packing expressjs project under arm env seems excluded static files by default, e.g. css style files
I used express-generator to setup an simple express project and tried to pack it. Build process passed and binary files generated as expected, but when running it and verified by browser. The issue is the style css file could not be found from browser and web page style is not correct.
Platform: Ubunto Mate 16.04 on Rasperberry Pi 3B with node.js version 8.6.0
testing express project was generated by this method: http://expressjs.com/en/starter/generator.html
Thank you
That smells like it's an express issue. Not a node-packer issue.
Try to route your stylesheet requests, like that
app.use('/styles', express.static(path.join(__dirname, 'styles_folder')));
Every request will be linked to the correct folder in the compiled app, even in the "non-compiled" app.
@Ni-vek thank you for commenting. But original express is correct:
app.use(express.static(path.join(__dirname, 'public')));
And I've verified via browser with original express code.
However, browser could not find corresponding css file when packed binary is running,
Any idea?
OK. What's the URL requested and your app structure?
URL requested is the root url, aka "/"
app structure could be fould from bottom of the page: http://expressjs.com/en/starter/generator.html
I just tried with a fresh generated express skeleton, and it works perfectly for me. Which options did you provide for compiling?
I cloned this src code and use bin/nodec for compilation:
bin/nodec ~/express/myapp/bin/www
How about yours @Ni-vek ? And can you pls share your compiled binary for me to verify? Thanks.
I've tried
./node-packer/bin/nodec myapp/bin/www
./node-packer/bin/nodec -o a.out myapp/bin/www
./node-packer/bin/nodec -o a.out -r myapp/ myapp/bin/www
Each ones work.
Try that https://drive.google.com/file/d/0B0QHZGlyZZuramNQbHRfMHpwM1U/view?usp=drivesdk
Thanks, @Ni-vek , I downloaded and found it is a MacOS binary, though I verified your binary and it did contain css file, it is different platform from mine (ARM Linux).
The commands you listed are the same as mine, so my issue is still there...
is it possible to extract built binary to see if css file is packed in?
@cnddu have you find any solution?, I have same problem on my platform (ARM).
@Ni-vek How do I explicitly define folders or files that need to be bundled which are not a part of the dependency tree but are used by the node script?