node-packer icon indicating copy to clipboard operation
node-packer copied to clipboard

packing expressjs project under arm env seems excluded static files by default, e.g. css style files

Open cnddu opened this issue 6 years ago • 12 comments

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

cnddu avatar Sep 30 '17 12:09 cnddu

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 avatar Sep 30 '17 20:09 Ni-vek

@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?

cnddu avatar Oct 01 '17 09:10 cnddu

OK. What's the URL requested and your app structure?

Ni-vek avatar Oct 02 '17 10:10 Ni-vek

URL requested is the root url, aka "/"

app structure could be fould from bottom of the page: http://expressjs.com/en/starter/generator.html

cnddu avatar Oct 02 '17 11:10 cnddu

I just tried with a fresh generated express skeleton, and it works perfectly for me. Which options did you provide for compiling?

Ni-vek avatar Oct 02 '17 16:10 Ni-vek

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.

cnddu avatar Oct 03 '17 13:10 cnddu

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.

Ni-vek avatar Oct 03 '17 15:10 Ni-vek

Try that https://drive.google.com/file/d/0B0QHZGlyZZuramNQbHRfMHpwM1U/view?usp=drivesdk

Ni-vek avatar Oct 03 '17 19:10 Ni-vek

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...

cnddu avatar Oct 04 '17 13:10 cnddu

is it possible to extract built binary to see if css file is packed in?

cnddu avatar Oct 04 '17 13:10 cnddu

@cnddu have you find any solution?, I have same problem on my platform (ARM).

JhalakJaviya avatar Mar 23 '18 11:03 JhalakJaviya

@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?

vnktram avatar Apr 11 '18 06:04 vnktram