# Can't Install New Palettes: EACCES

**URL:** <https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044>\
**Category:** General\
**Created:** [16 March 2019 07:21 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044 "2019-03-16T07:21:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![IcyMidnight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/icymidnight/32/6827_2.png) [@IcyMidnight](https://discourse.nodered.org/u/IcyMidnight)\
**Post date:** [16 March 2019 07:21 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044/1 "2019-03-16T07:21:15Z")

</div>

I'm trying to get Node Red up and running in docker, but I can't install new palettes. It seems that the node installer is trying to place its modules in the root directory instead of in /data

```auto
sudo docker create \                           
  -p 1880:1880 \
  -v /usr/share/nodered/data:/data \
  --link mosquitto:mosquitto \
  --restart unless-stopped \
  --user 2003:2003 \
  --name nodered \
  nodered/node-red-docker:latest

```

If I try to install from the Manage Palettes area I get the following error:

```auto
-----------------------------------------------------------
2019-03-16T06:27:37.017Z Install : node-red-contrib-home-assistant 0.3.2
2019-03-16T06:27:37.054Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-contrib-home-assistant@0.3.2
2019-03-16T06:27:37.619Z [err] Unhandled rejection Error: EACCES: permission denied, mkdir '/.npm'
2019-03-16T06:27:37.619Z [err] npm ERR! cb() never called!
2019-03-16T06:27:37.620Z [err] 
2019-03-16T06:27:37.620Z [err] npm ERR!
2019-03-16T06:27:37.620Z [err] This is an error with npm itself. Please report this error at:
2019-03-16T06:27:37.620Z [err] npm ERR! <https://npm.community>
2019-03-16T06:27:37.622Z rc=1

```

And if I try to do it from within the container as suggested, I run into a similar error:

```auto
$ cd /data
I have no name!@def387831f9c:/data$ npm install node-red-contrib-home-assistant
Unhandled rejection Error: EACCES: permission denied, mkdir '/.npm'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>

```

Did I miss something in my setup? Why is node trying to install into / instead of /data?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [16 March 2019 07:36 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044/2 "2019-03-16T07:36:07Z")

</div>

Did you try `sudo npm install ...` from the container ?

---

<div class="post-metadata">

**Author:** ![IcyMidnight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/icymidnight/32/6827_2.png) [@IcyMidnight](https://discourse.nodered.org/u/IcyMidnight)\
**Post date:** [16 March 2019 08:46 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044/3 "2019-03-16T08:46:15Z")

</div>

```auto
$ sudo npm install node-red-contrib-home-assistant-websocket
bash: sudo: command not found

```

Looks like sudo isn't baked into the docker image.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [16 March 2019 09:09 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044/4 "2019-03-16T09:09:17Z")

</div>

`/usr/share/` is owned by root ?  
Perhaps try to use a dir that is owned by the user you use to run docker container, if that is root then I don't know.

---

<div class="post-metadata">

**Author:** ![IcyMidnight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/icymidnight/32/6827_2.png) [@IcyMidnight](https://discourse.nodered.org/u/IcyMidnight)\
**Post date:** [16 March 2019 09:26 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044/5 "2019-03-16T09:26:00Z")

</div>

I made sure to set the permissions correctly, AFAICT:

```auto
/usr/share/nodered % ls -ahl
total 12K
drwxr-xr-x 3 nodered nodered 4.0K Mar 14 22:59 .
drwxr-xr-x 142 root root 4.0K Mar 16 02:07 ..
drwxr-xr-x 3 nodered nodered 4.0K Mar 16 01:49 data

```

In fact, Node Red was able to write all of its initial configuration out without issues. The problem appears to be that npm wants to write its files to /.npm instead of somewhere inside /data/...

---

<div class="post-metadata">

**Author:** ![HenroRitchie](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@HenroRitchie](https://discourse.nodered.org/u/HenroRitchie)\
**Post date:** [16 March 2019 14:47 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044/6 "2019-03-16T14:47:45Z")

</div>

I am using docker-compose to get a couple of NR instances going. Have you tried docker-compose instead of the command line?

---

<div class="post-metadata">

**Author:** ![IcyMidnight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/icymidnight/32/6827_2.png) [@IcyMidnight](https://discourse.nodered.org/u/IcyMidnight)\
**Post date:** [24 March 2019 00:09 UTC](https://discourse.nodered.org/t/cant-install-new-palettes-eacces/9044/7 "2019-03-24T00:09:26Z")

</div>

By the way, I figured out the problem. Using the --user 2003:2003 makes docker run as user 2003, but the docker file just create a new user (which ended up with id 1001, IIRC):

```auto
RUN useradd --home-dir /usr/src/node-red --no-create-home node-red \
  && chown -R node-red:node-red /data \
  && chown -R node-red:node-red /usr/src/node-red

```

The container mostly works, because the mapped volume `-v /usr/share/nodered/data:/data` is also owned by 2003:2003 in the host; I just can't install new npm modules.

I'm going to see about creating a sub-image that changes the internal node-red user to have a different uid.
