Last Updated: April 07, 2019
·
40.77K
· harshadkale

Node and NPM on Chromebook (Chrome OS)

Considering that you already have rootfs write access and and have switched on your chromebook to dev mode, it is possible to install NodeJS dev env on chromebook (keeping your OS to ChromeOS. This article is not about ChrUbuntu)

If you need help with dev mode and rootfs write access, consider following Chromium OS poking around article.

Download xz package and nodejs package from ArchLinux -
xz - http://www.archlinux.org/packages/core/i686/xz/
node - https://www.archlinux.org/packages/community/i686/nodejs/
There is a little ‘Download from mirror’ link on the page. If you don’t find, just Find on Page for word ‘download’. Both these downloaded packages should be in your Downloads folder that opens up when you open Chrome OS files app.
switch to terminal (Ctrl+Alt+T) will open terminal as one of the browser tabs.
type SHELL, enter (opens shell)

$ sudo su , enter (switch to root)

$ pwd, enter (it should display only / )

$ cd /home/chronos/user/Downloads/

$ tar -xvf xz*.tar.xz

$ cd /usr/bin

$ cp * /usr/bin

$ cd ..

$ cd .. (doing it twice will bring you back to Downloads directory)

$ xz -d node*.tar.xz

$ tar -xvf node*.tar

$ cd /usr/bin

$ cp * /usr/bin

$ cd ..

$ cd ..

$ node -v (should display you the installed node version)

$ curl https://npmjs.org/install.sh (download this file to same Downloads folder)

$ sh install.sh (will install npm)

$ npm version (should display npm version, might be outdated)

$ npm update npm -g (npm can update itself)

$ npm version (should be latest now)

AND JOY!

14 Responses
Add your response

Could you write an article on how to gain rootfs access on the Chromebook. It's been a bit difficult finding and article that clearly states how to do this.

over 1 year ago ·

Thanks for the link, I'll be sure to read it. @harshadkale

over 1 year ago ·

Your instruction "cd /usr/bin" should be "cd usr/bin" - further into the current directory tree - not from root.

Also (this may be because I am in dev mode with verified boot still), my /usr/bin or lib folders are not writable. I tried to /usr/local/bin, lib, share but that didn't work.

over 1 year ago ·

I followed above steps to install node.
The ls command shows that node and npm files are present in usr/local/bin but when I try to execute node from the same directory it says
bash: /usr/local/bin: No such file or directory.

over 1 year ago ·

I am having the same problem in that my /usr/bin is not writeable. if I try to execute node in the same directory it's in with ./node -v I get a permission denied. I tried cp * /usr/local, as local was the only writeable directory I could find. When I try to execute node in the local directory I get "can not execute binary."

can you help me figure out how to get node up and running? Thank you so very, very much! BTW: I really enjoyed your Bootcamp 3 tutorials.

max

over 1 year ago ·

Update: so using information in the link you provided I made my usr/bin writeable and copied the files into /usr/bin. Now when i try to execute xz or node I get "cannot execute binary file".

Any ideas? Thanks!

over 1 year ago ·

I was getting the "cp: cannot create regular file ‘*’: Read-only file system" errors even after enabling dev mode and running:

sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification

and:

sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 4

But running:

sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 2

Fixed that read error but now I get this one:

xz -d node*.tar.xz
bash: /usr/bin/xz: cannot execute binary file
over 1 year ago ·

I had the same problems than @maxutter and @dieseltravis: 'cannot execute binary file'

This is caused by the fact that Chrome OS is now on 64 bit CPU, so you need to download the x86_64 files instead of the i864.

See this post for more details: http://blog.diniscruz.com/2014/11/chrome-os-is-now-running-under-64-bit.html

over 1 year ago ·

@kgingeri is correct on the typo for directory switching. In both places it should be "cd usr/bin".

@diniscruz is also correct in needing to download the 64 bit versions of both packages.

@harshadkale gives a good official link on making the file system writable, but it throws an error since the command has changed. You will get a suggestion you only do remove rootfs for a specific partition, or do the following for ALL partitions, which is not recommended for safety.
$ sudo /usr/share/vboot/bin/makedevssd.sh --removerootfsverification --partitions N

After all of those differences from these 2013 instructions, I was able to get things to install correctly.

over 1 year ago ·

I'm on Acer C720 in dev mode, but i can't continue from 'cp * /usr/bin' even after the @dieseltravis technique
'sudo /usr/share/vboot/bin/makedevssd.sh --removerootfsverification --partitions 2' because i have the "cp: cannot create regular file ‘*’: Read-only file system" errors again and again.

over 1 year ago ·

The cp command returns the error "missing destination file operand after '*/usr/bin'"

Any suggestions on how to solve this?

over 1 year ago ·

@mlionel92 I think you are missing a space character between '*' and '/usr/bin'

over 1 year ago ·

Thanks for putting this together... I am running into an issue where when I try sh install.sh I get a message that node.js is needed. It may be a situation where the cp command is not moving the files to the correct directory.

over 1 year ago ·