-
Notifications
You must be signed in to change notification settings - Fork 29
Description
I just struggled to install full-icu on a fresh Ubuntu 16.04 system with node v6.11.2 (npm v3.10.10). Node was installed using the official instructions.
The error I got was:
root@frondev:~# npm install -g full-icu
/usr/bin/node-full-icu-path -> /usr/lib/node_modules/full-icu/node-icu-data.js
> full-icu@1.2.0 postinstall /usr/lib/node_modules/full-icu
> node postinstall.js
npm install icu4c-data@56l (Node 6.11.2 and small-icu 56.1) -> icudt56l.dat
full-icu$ /usr/bin/nodejs /usr/lib/node_modules/npm/bin/npm-cli.js install icu4c-data@56l
npm ERR! Linux 4.4.0-87-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/lib/node_modules/npm/bin/npm-cli.js" "install" "icu4c-data@56l"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! path /root/.npm/icu4c-data/0.56.2/package
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/root/.npm/icu4c-data/0.56.2/package'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, mkdir '/root/.npm/icu4c-data/0.56.2/package'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/root/.npm/icu4c-data/0.56.2/package' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
After opening permissions for the required directories, the installation of package icu4c-data proceeds further, and I can see that files are created with owner nobody. There is also no issue when installing locally (unprivileged user). Finally installing icu4c-data globally with a standalone npm install -g icu4c-data@56l works as well!
I am not familiar enough with npm to pinpoint the issue, I just saw from its configuration that there is a mechanism for switching user when running in privileged/global mode. I was eventually able to install with the following workaround (running as root); note the owner compared with other global modules:
npm set -g unsafe-perm
npm install -g full-icu
npm set -g unsafe-perm false
root@frondev:~# ll /usr/lib/node_modules/
total 32
drwxr-xr-x 8 root root 4096 Aug 24 12:56 ./
drwxr-xr-x 55 root root 4096 Aug 24 11:07 ../
drwxr-xr-x 2 nobody root 4096 Aug 24 11:25 commander/
drwxr-xr-x 2 root root 4096 Aug 24 12:56 full-icu/
drwxr-xr-x 2 root root 4096 Aug 24 12:56 icu4c-data/
drwxr-xr-x 5 nobody root 4096 Aug 24 11:39 mjml/
drwxr-xr-x 7 nobody root 4096 Aug 24 11:30 nodemon/
drwxr-xr-x 11 root root 4096 Aug 24 11:07 npm/