<p>I figured out the issue: there were some directories that were owned by root that needed to be owned by my user.</p>

<p>I made myself owner of some npm-related folders, for instance:</p>

<p><code>sudo chown -R `whoami` /usr/local/lib/node_modules</code></p>

<p>...and that seems to have fixed the issue.</p>

CC BY-SA 4.0
2019-10-08T16:03:02.230Z
2019-10-08T16:03:02.230Z
Chris Guida
<p>Maybe the directory doesnt have the proper rights, try this command <code>sudo chmod 777</code> </p>

<p>If it still  doesnt work try these flag before your install <code>sudo npm install -g --unsafe-perm</code> </p>

<p>or <code>sudo node-gyp rebuild -g --unsafe-perm</code></p>

<p>then try again</p>

CC BY-SA 4.0
2019-09-18T20:29:19.777Z
Maybe the directory doesnt have the proper rights, try this command sudo chmod 777: Which directory are you referring to?
Chris Guida
CC BY-SA 4.0
2019-09-18T20:35:50.437Z
/usr/local/lib/node_modules/canvas see this thread also https://stackoverflow.com/questions/42308879/npm-err-code-elifecycle
Saxtheowl
CC BY-SA 4.0
2019-10-08T16:01:40.650Z
You're right, I didn't have permission on a number of directories, including /usr/local/lib/node_modules.
Chris Guida
CC BY-SA 4.0
2019-09-18T04:29:52.860Z
2019-09-18T08:10:34.473Z
2019-09-18T08:10:34.473Z
Saxtheowl
<p>Configuring npm to install global packages to your user directory goes a long way to make these pesky permission issues go away.</p>

<p>See: <a href="https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory" rel="nofollow noreferrer">https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory</a></p>

CC BY-SA 4.0
2019-10-15T00:20:31.223Z
2019-10-15T00:20:31.223Z
shesek
<p>Trying to install <a href="https://github.com/ElementsProject/filebazaar" rel="nofollow noreferrer">filebazaar</a> on Ubuntu 18.04 and getting an error on the <code>canvas</code> module... anyone familiar with this issue? I've been all over node-canvas's github issues (such as <a href="https://github.com/Automattic/node-canvas/issues/788" rel="nofollow noreferrer">this one</a> where I left a comment), but none of the solutions are working for me so far.</p>

<p>Here's the command I'm running:</p>

<pre><code>$ sudo npm install -g filebazaar
</code></pre>

<p>And here's the error output:</p>

<pre><code>$ sudo npm install -g canvas@1.6.13

&gt; canvas@1.6.13 install /usr/local/lib/node_modules/canvas
&gt; node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/canvas/build'
gyp ERR! System Linux 4.15.0-55-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/canvas
gyp ERR! node -v v12.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@1.6.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.6.13 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/chris/.npm/_logs/2019-09-17T20_39_13_514Z-debug.log
</code></pre>

<p>Any assistance is appreciated :)</p>

<lightning-network><compiling>
Running into ELIFECYCLE error while trying to install filebazaar
Chris Guida
# Running into ELIFECYCLE error while trying to install filebazaar

(Asked by: username_0 on 2019-09-17)

Trying to install [filebazaar](https://github.com/ElementsProject/filebazaar) on Ubuntu 18.04 and getting an error on the `canvas` module... anyone familiar with this issue? I've been all over node-canvas's github issues (such as [this one](https://github.com/Automattic/node-canvas/issues/788) where I left a comment), but none of the solutions are working for me so far.

Here's the command I'm running:

```
$ sudo npm install -g filebazaar

```

And here's the error output:

```
$ sudo npm install -g canvas@1.6.13

> canvas@1.6.13 install /usr/local/lib/node_modules/canvas
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/canvas/build'
gyp ERR! System Linux 4.15.0-55-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/canvas
gyp ERR! node -v v12.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@1.6.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.6.13 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/username_0/.npm/_logs/2019-09-17T20_39_13_514Z-debug.log

```

Any assistance is appreciated :)

**Tags:** lightning-network, compiling


---

## 3 answers

### Answer by username_0 on 2019-10-08. Score: 0

I figured out the issue: there were some directories that were owned by root that needed to be owned by my user.

I made myself owner of some npm-related folders, for instance:

`sudo chown -R `whoami` /usr/local/lib/node_modules`

...and that seems to have fixed the issue.


---

### Answer by username_1 on 2019-09-18. Score: 0

Maybe the directory doesnt have the proper rights, try this command `sudo chmod 777`

If it still doesnt work try these flag before your install `sudo npm install -g --unsafe-perm`

or `sudo node-gyp rebuild -g --unsafe-perm`

then try again

> **Comments:**
> **username_0**: Maybe the directory doesnt have the proper rights, try this command sudo chmod 777: Which directory are you referring to?  
> **username_1**: /usr/local/lib/node_modules/canvas see this thread also https://stackoverflow.com/questions/42308879/npm-err-code-elifecycle  
> **username_0**: You're right, I didn't have permission on a number of directories, including /usr/local/lib/node_modules.  

---

### Answer by username_2 on 2019-10-15. Score: 0

Configuring npm to install global packages to your user directory goes a long way to make these pesky permission issues go away.

See: <https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory>


---

