Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cnddu opened this issue Sep 30, 2017 · 12 comments

Comments

@cnddu
Copy link

cnddu commented Sep 30, 2017

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

@Ni-vek
Copy link

Ni-vek commented Sep 30, 2017

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.

@cnddu
Copy link
Author

cnddu commented Oct 1, 2017

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

@Ni-vek
Copy link

Ni-vek commented Oct 2, 2017

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

@cnddu
Copy link
Author

cnddu commented Oct 2, 2017

URL requested is the root url, aka "/"

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

@Ni-vek
Copy link

Ni-vek commented Oct 2, 2017

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

@cnddu
Copy link
Author

cnddu commented Oct 3, 2017

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.

@Ni-vek
Copy link

Ni-vek commented Oct 3, 2017

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
Copy link

Ni-vek commented Oct 3, 2017

@cnddu
Copy link
Author

cnddu commented Oct 4, 2017

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
Copy link
Author

cnddu commented Oct 4, 2017

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

@cnddu cnddu mentioned this issue Oct 8, 2017
@cnddu cnddu changed the title packing expressjs project seems excluded static files by default, e.g. css style files packing expressjs project under arm env seems excluded static files by default, e.g. css style files Oct 8, 2017
@JhalakJaviya
Copy link

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

@vnktram
Copy link

vnktram commented Apr 11, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants