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

Throw permission error when using node@v2.1.1 #177

Closed
NajamShehzad opened this issue Jul 26, 2020 · 4 comments
Closed

Throw permission error when using node@v2.1.1 #177

NajamShehzad opened this issue Jul 26, 2020 · 4 comments

Comments

@NajamShehzad
Copy link

When I'm trying to install a package globally it throws an error "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'"
Was installing lighthouse CLI using "npm i -g @lhci/cli@0.4.x"
Github Issue

@alexrp
Copy link

alexrp commented Nov 17, 2020

Older versions of the action do not have this issue (e.g. v1.4.3). Unfortunately, older versions are now hitting the add-path/set-env deprecation, making this situation even more annoying.

@linkvt
Copy link

linkvt commented Dec 23, 2020

I looked into the code and found the reason for this. setup-node said already in v1, that the version parameter is optional, but this is only really the case since v2.

In v1 there was a default set that was used when no version was specified:

default: '10.x'

In v2 this default is gone which is IMO intended, so setup-node won't do anything with the already existing node installations on the machine. As the runner runs with the runner user and not as root it doesn't have write permissions in /usr/local/bin/node

To use the existing node version to install global packages you should just put a sudo in front of the npm command to have - run: sudo npm install -g package@version.

hackergil added a commit to SAP/spartacus that referenced this issue Feb 17, 2021
@dmitry-shibanov
Copy link
Contributor

Hello everyone. I think the issue was fixed from virtual-environments side. I've tried to reproduce the issues on the hosted images from my side but it works as expected.

Could you please confirm that it works for you ?

@NajamShehzad
Copy link
Author

Hello everyone. I think the issue was fixed from virtual-environments side. I've tried to reproduce the issues on the hosted images from my side but it works as expected.

Could you please confirm that it works for you ?

Yeah! It's working now :)

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
…ions#177)

Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

4 participants