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

npm rebuild fails when compiling native packages #43

Closed
kmohrf opened this issue Mar 3, 2017 · 4 comments
Closed

npm rebuild fails when compiling native packages #43

kmohrf opened this issue Mar 3, 2017 · 4 comments

Comments

@kmohrf
Copy link
Contributor

kmohrf commented Mar 3, 2017

hi,

first of all thank you very much for working on this. i very much like the fact that i don’t have to get into debian packaging :).

i want to use node-deb with mirror-mirror. the debian-pkg branch contains the necessary changes. packaging itself works fine but npm rebuild --production in postinst fails. it seems like npm is quite picky about the build environment and considering that i compile code from – somewhat – untrusted sources that might be a good thing.
unfortunately this means that my sqlite dependency will throw an exception when npm tries to build it.

this can easily be fixed by using --unsafe-perm for npm install/rebuild but i’m not sure if this would be smart. anyway… i think this needs a solution. maybe it’s a good idea to chown the node_modules directory to the package user than executing rebuild/install and chown-ing it back.

i’ll try to submit a pull request if you favor any solution.

thanks!

@heartsucker
Copy link
Owner

Hmm this one is a bit tougher to figure out. I can take a peek at it, but I'm almost tempted to throw a --no-rebuild flag along with an --arch {amd64, i386, etc} flag in there to allow package maintainers to handle builds how they best see fit.

Are you doing anything exotic with your build environment? How is that different than where you are deploying it?

@kmohrf
Copy link
Contributor Author

kmohrf commented Mar 3, 2017

my build environment is archlinux. i installed debhelper debianutils and devscripts from the arch user repositories (meaning they’re not official packages and build from user-contributed package specifications). but they should be fine. i’m building on x64 which is also the target platforms architecture (so in my specific case node_modules might already contain the correct node package builds). things that differ are node (v7.7.1 locally, v4.7.2 on deploy target) and npm (v4.3.0 locally, v1.4.21 on deploy target) though i have been using yarn locally to install dependencies.

up until now i deployed in a debian chroot, that i created with cdebootstrap (cdebootstrap-static stretch debian). i only installed curl, nodejs nodejs-legacy npm vim less. so this is a fairly basic system. if you believe the problems might be caused by the build enviroment i’ll try to build the package in the chroot.

@kmohrf
Copy link
Contributor Author

kmohrf commented Mar 4, 2017

i ran a second build in the debian chroot. npm took about ~35 minutes but the resulting build worked out of the box. but i guess that’s just because sqlite didn’t do anything this time. dpkg logged the following lines

[sqlite3] Success: "/usr/share/mirror-mirror/app/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

i guess the no-rebuild flag would be a good idea. in that case i could run node-deb on a debian build server with yarn and be done with it.

@heartsucker
Copy link
Owner

Fixed by c3a8c10 and 65b7f8c.

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

2 participants