rcn-ee / repos

repos.rcn-ee.com
41 stars 30 forks source link

Can't install Node.js native modules on Buster #36

Closed fivdi closed 6 years ago

fivdi commented 6 years ago

I'm not sure if this is the correct repository for this issue so my apologies if it isn't.

Node.js v8.9.4 which is provided with Buster image bone-debian-buster-iot-armhf-2018-02-04-4gb.img.xz at https://rcn-ee.net/rootfs/bb.org/testing/2018-02-04/buster-iot/ can't be used to install native modules (modules that contain C/C++ code) on a PocketBeagle.

For example, attempting to install native module i2c-bus with npm install i2c-bus results in a permission denied error. Please scroll at the way to the right to see the permission denied error:

debian@beaglebone:~/i2c-bus$ npm install i2c-bus

> i2c-bus@1.2.5 install /home/debian/i2c-bus/node_modules/i2c-bus
> node-gyp rebuild

/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: 5: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js: Permission denied
npm WARN enoent ENOENT: no such file or directory, open '/home/debian/i2c-bus/package.json'
npm WARN i2c-bus No description
npm WARN i2c-bus No repository field.
npm WARN i2c-bus No README data
npm WARN i2c-bus No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! i2c-bus@1.2.5 install: `node-gyp rebuild`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the i2c-bus@1.2.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/debian/.npm/_logs/2018-02-09T15_44_06_194Z-debug.log
debian@beaglebone:~/i2c-bus$ 

This appears to be a problem with all native modules and not only with i2c-bus. Calling npm install i2c-bus doesn't compile the C/C++ code and nothing actually gets installed.

Using sudo and --unsafe-perm doesn't resolve the issue:

debian@beaglebone:~/i2c-bus$ sudo npm install --unsafe-perm i2c-bus
[sudo] password for debian: 

> i2c-bus@1.2.5 install /home/debian/i2c-bus/node_modules/i2c-bus
> node-gyp rebuild

/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: 5: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js: Permission denied
npm WARN enoent ENOENT: no such file or directory, open '/home/debian/i2c-bus/package.json'
npm WARN i2c-bus No description
npm WARN i2c-bus No repository field.
npm WARN i2c-bus No README data
npm WARN i2c-bus No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! i2c-bus@1.2.5 install: `node-gyp rebuild`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the i2c-bus@1.2.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-02-09T16_12_50_787Z-debug.log
debian@beaglebone:~/i2c-bus$ 

If Node.js v8.9.4 is downloaded from nodejs.org at https://nodejs.org/dist/v8.9.4/ and installed everything functions correctly. It's possible to install i2c-bus without errors.

fivdi commented 6 years ago

It looks like it's now possible to install Node.js native modules with Buster testing images.

It works with bone-debian-buster-iot-armhf-2018-10-07-4gb.img.xz downloaded from https://debian.beagleboard.org/images/rcn-ee.net/rootfs/bb.org/testing/2018-10-07/buster-iot/

RobertCNelson commented 6 years ago

@fivdi yeah, npm just landed about a month ago:

https://tracker.debian.org/pkg/npm

after it had been removed..

I have a feeling we aren't going to get another bump of nodejs from Jeremy, he seems to busy with day job:

https://tracker.debian.org/pkg/nodejs

I'd really like to see nodejs v10.x to land in buster before freeze..

Regards,

fivdi commented 6 years ago

NodeSource provide armhf Node.js v10.x binary distributions for Debian 8, 9, 10 and unstable. I'm not sure if you could use them or want to use them for creating images though.

fivdi commented 6 years ago

BoneScript doesn't install successfully with Node.js v10.x. The output of calling npm i bonescript on a BeagleBone Black with Node.js v10.12.0 and npm v6.4.1 can be seen here. Some of the compile errors can be eliminated by upgrading optionalDependencies in BoneScripts package.json but some can't, for example, the errors from the i2c dependency.