Can I build a package requiring npm in Chrome OS?

44 views
Skip to first unread message

Hirokazu Honda

unread,
Dec 7, 2017, 11:36:23 PM12/7/17
to Chromium OS dev
Hi, I am trying to add a new package. The CL is crosreview.com/781599.
npm is required for building a package.
I found third_party/chromiumos-overlay/net-libs/iojs. Looks like it
installs npm. Is it correct?
If yes, I think I can use npm to build shaka-player if I add
net-libs/iojs to the dependency of autotest-deps-shaka.ebuild.
I actually do so. However, I got errors when building iojs. The error
log is attached.

Thanks,
-Hiro
net-libs:iojs-1.4.1-r1:20171207-140906.log

Mike Frysinger

unread,
Dec 8, 2017, 12:54:47 AM12/8/17
to Hirokazu Honda, Chromium OS dev
currently nodejs/npm are not available inside the sdk.  there was one project that was using node on the board itself, but i don't think that was ever released, so you'll find random references like iojs in the tree.
-mike


--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en


Hirokazu Honda

unread,
Dec 8, 2017, 2:57:51 AM12/8/17
to Mike Frysinger, Chromium OS dev
Thank you for the information.
So it is required to build iojs so that a package is built with npm.
As I said, building iojs is failed currently.
Should I file this bug?

-Hiro

Mike Frysinger

unread,
Dec 8, 2017, 2:20:12 PM12/8/17
to Hirokazu Honda, chromium-os-dev
no one uses iojs, so I don't think a bug would help if your expectation is to have someone fix it. if you need the package, then you'd probably be on the hook to fix it.  if you want to post a cl to delete it, seems like it would be reviewed quickly.
-mike

Hirokazu Honda

unread,
Dec 25, 2017, 10:32:46 PM12/25/17
to Mike Frysinger, chromium-os-dev
I just uploaded the CL to update iojs version.
https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/844051
I confirmed iojs was built successfully. With the iojs, I tried to
build shaka-player, but I got an error which there is no npm in the
build environment.
> >>> Configuring source in /build/cyan/tmp/portage/chromeos-base/autotest-deps-shaka-2.2.6/work/shaka-player-2.2.6 ...
> /build/cyan/tmp/portage/chromeos-base/autotest-deps-shaka-2.2.6/temp/environment: line 1089: npm: command not found

npm is installed /build/cyan/usr/bin/npm by iojs ebuild.

Best,
-Hiro

Mike Frysinger

unread,
Jan 4, 2018, 3:19:04 AM1/4/18
to Hirokazu Honda, chromium-os-dev
/build/xxx/ is the sysroot.  you can only compile/link against files in there.  npm is a tool that executes in the sdk build system.  we cannot (by design) execute programs out of the sysroot.  build time tools have to be part of the SDK itself.  see the virtual/target-chromium-os-sdk package.
-mike

Hirokazu Honda

unread,
Jan 9, 2018, 4:14:23 AM1/9/18
to Mike Frysinger, chromium-os-dev
Ah, I misunderstand what you said.
Adding npm to sdk is needed in order to use npm when building the
package in sysroot.
Concretely, net-libs/nodejs is added to RDEPEND in
virtual/target-chromium-os-sdk.
I don't know this is allowed though.

Apparently, although iojs is not related to this issue, I am willingly
going to update it as I said above.

Mike Frysinger

unread,
Jan 9, 2018, 4:10:47 PM1/9/18
to Hirokazu Honda, chromium-os-dev
looks like nodejs is built from source rather than a binpkg.  that's what we'd want.

whether we can bundle it in the SDK by default comes down largely to the question of "how much disk space does this new package (and any new deps) add to the system?".
-mike

Hirokazu Honda

unread,
Jan 9, 2018, 10:33:19 PM1/9/18
to Mike Frysinger, chromium-os-dev
I measured the size before and after nodejs is added to ChromiumOS SDK
in the following way.
$ cros_sdk --delete && cros_sdk --enter
$ du -shb chroot
6518874919 chroot
$ # add net-libs/nodejs to ChromiumOS SDK
$ cros_sdk --delete && cros_sdk --enter
$ du -shb chroot
6558798401 chroot

I am not sure it is a right way though.
The growth is about 39Megabytes.
What do you think?

Mike Frysinger

unread,
Jan 9, 2018, 11:13:05 PM1/9/18
to Hirokazu Honda, chromium-os-dev
if nodejs doesn't pull in anything new, you can just run `qsize nodejs` to get details
-mike

Hirokazu Honda

unread,
Jan 9, 2018, 11:30:03 PM1/9/18
to Mike Frysinger, chromium-os-dev
(cr) ((ea59b37...)) hiroh@hiroh ~/trunk/src/scripts $ qsize nodejs
net-libs/nodejs-6.9.1: 1,778 files, 581 non-files, 26,301.817 KiB

Got it.
It is about 27 Megabytes, according to qsize.

Mike Frysinger

unread,
Jan 16, 2018, 2:39:33 PM1/16/18
to Hirokazu Honda, chromium-os-dev
i think that should be OK for the SDK
-mike

beliefless dogmasless

unread,
Jan 24, 2018, 12:21:13 PM1/24/18
to Chromium OS dev
Not tested, but there is this:

You install Linuxbrew, then after on Linuxbrew, you install npm
Reply all
Reply to author
Forward
0 new messages