Closed albfan closed 5 years ago
Thanks for reporting!
What about setting the permissions for the global npm
package install directory instead of setting the --unsafe-perm
flag? This way we could avoid using sudo
for global install. Cf. this example.
I'll close this issue since we're not going to change the default install command here. Disabling the need of sudo
should be enough. Feel free to re-open if you have further findings.
This issue was about --unsafe-perm=true
. Using sudo is not the problem here. I can do a:
$ sudo su -
# npm install bpmn-to-image
And still need that option to install correctly.
sudo
is used because modules are installed on /usr/lib/node_modules
with is owned by root (same as you do sudo pacman -S
or sudo apt-get install
) so any user on the distro can use it.
I work on a Mac, but setting the permissions for global node_modules
and the current user did the trick for me:
sudo chown -R $(whoami) /opt/local/lib/node_modules
Not sure about Ubuntu or other Linux distributions, but setting the permissions for the global install directory should follow to install the package globally without sudo
, which made the error disappear in my case.
However, you can still use the --unsafe-perm=true
, you're free to use whatever you want to on your local machine. But we simply don't want to commit this solution to our README instructions in an official manner.
You're changing the owner of a global directory to fix npm install. I understand that seems ok for you as the only user of your laptop. But that's a security hole. That user can install anything on npm and hack other users usage of npm.
So forget about sudo, imagine I log with root and have permissions to write everywhere, I still will need --unsafe-perm=true
.
I'm ok if you close this issue, I was just reporting in case it helps anyone. The problem seems related with puppeteer and chromium, so it hits here by coincidence.
Running the suggested command to install leads to:
Using the
unsafe-perm
option it installs correctly: