Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap-installed nodejs fails to install web-ext globally #2267

Open
plwt opened this issue Jun 14, 2021 · 3 comments
Open

Snap-installed nodejs fails to install web-ext globally #2267

plwt opened this issue Jun 14, 2021 · 3 comments

Comments

@plwt
Copy link

plwt commented Jun 14, 2021

Is this a feature request or a bug?

Bug

What is the current behavior?

  1. Installed Node using the official Snap from GNOME software (installation method also recommended by Node on their site)
  2. Node version confirmed as 14.7.0 and add-ons linter works fine
  3. Installed web-ext with sudo npm install --global web-ext
  4. Install fails with error Failed at the [email protected] postinstall script. Full log attached at 2021-06-14T20_15_57_535Z-debug.log

What is the expected or desired behavior?

web-ext installs without error

Version information (for bug reports)

  • Firefox version: 91.0a1
  • Your OS and version: Xubuntu 21.04
  • Paste the output of these commands:
node --version && npm --version && web-ext --version

v14.17.0
6.14.13
web-ext: command not found

@rpl
Copy link
Member

rpl commented Jun 16, 2021

@SeburoSUMO I'm currently unable to reproduce this using the snap package installed on Ubuntu 20.04.2 (web-ext was installed globally just fine and the core-js message was printed on the console.

Based on the stack trace I would guess that on your system it did fail to execute the node binary while executing node -e "try{require('./postinstall')}catch(e){}" for the core-js postinstall script.

I'm going to give it another try on an ubuntu 21.04 installation (in a virtual machine) as soon as I can, but in the meantime would you mind to double-check if /snap/bin is actually part of the $PATH for the root user on your system?

At the moment, the only thing that I can think of that could trigger that issue is the root user not having /snap/bin in the PATH environment variable (which honestly it seems unlikely, but may be worth to still double-check if that is the case).

@plwt
Copy link
Author

plwt commented Jun 16, 2021

@rpl, it does appear that /snap/bin is the PATH. The contents of /etc/environment is:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"

@rpl
Copy link
Member

rpl commented Jun 22, 2021

@SeburoSUMO I've been able to reproduce it on a vanilla Xubuntu 21.04 system installed in a VM.

The issue seems to be due to snap confinement (even if technically this snap package has to be installed using snap --classic) it looks that there are some apparmor based restrictions which are triggering the issue.

I did find the following issues (and one pull request in the snapd repo) related to the issue with snap-packaged nodejs:

There is also a workaround that make the snap-packaged nodejs to work just fine, the details are described in this nodejs doc page: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory.

In practice the workaround prevents the issue because it does configure npm to put the global installed packages into a directory where the user does have read-write permissions and no apparmor rule would block the npm installation to complete successfully.

@rpl rpl changed the title Unable to install web-ext ("Failed at the [email protected] postinstall script." error) Snap-installed nodejs fails to install web-ext globally Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants