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

npm install npm@version not working on the mac image #31

Closed
dougmoscrop opened this issue Aug 15, 2019 · 8 comments
Closed

npm install npm@version not working on the mac image #31

dougmoscrop opened this issue Aug 15, 2019 · 8 comments
Assignees
Labels
external Unexpected behavior was caused by external problems

Comments

@dougmoscrop
Copy link

dougmoscrop commented Aug 15, 2019

It would be cool to optionally specify which version of npm is used regardless of the node version (use case: I am using AWS Lambda with the 8.10 runtime, but I want to use npm@6.7.0)

@damccorm damccorm self-assigned this Aug 16, 2019
@damccorm
Copy link
Contributor

This is a fair suggestion, and one I've given some thought to, but I think we're probably not going to do this. We've had some discussion surrounding this, but in general, we view the setup-* actions as actions to setup the tool but not the ecosystem around it - so the setup actions should work like node's installer executable does. Npm is a little bit of a tricky case because the installer packages npm with Node, so its not clear where the tool ends and the ecosystem starts. For now, though, we've decided to adopt the same behavior as the installer executable and not install different versions of npm and/or Yarn.

FWIW, I'm also a little less worried about this one because its relatively easy to fix - just add a step run: npm install --global npm@6.7.0. Again, this feels like the line that the Node installer draws.

Does that make sense/seem reasonable?

@dougmoscrop
Copy link
Author

dougmoscrop commented Aug 16, 2019

It is reasonable and the first thing I tried, but it seemed like the global install worked but was not effective (so my next steps that ran still used the old version).

Maybe I did something wrong, but getting npm@6 using node 8.10 didn't work, like:

npm i -g npm@6
npm ci

failed with 'ci' not being a known command (it looked like npm@5 was still the one in effect)

Let me check if I did something wrong and I'll get back to you. If it works, the debate is basically do we want to save half a dozen characters - which I agree is probably not worth it! If not, I'm not sure what would be needed to make it work

@damccorm
Copy link
Contributor

Huh, that's weird. If that's not working, we definitely should fix that!

With that said, I'm not able to reproduce. Could you try running npm -v before/after doing the global install and see if we're getting the correct version of npm that way?

Also, if your repo is public would you mind sharing it?

@dougmoscrop
Copy link
Author

For sure, let me just make sure I didn't do something stupid.

@dougmoscrop
Copy link
Author

dougmoscrop commented Aug 16, 2019

Here's an example:

https://github.com/dougmoscrop/serverless-plugin-log-subscription/pull/9/checks?check_run_id=195597827

Is it because I am doing this in separate steps?

Maybe it's just worth a setup-npm action?

@damccorm
Copy link
Contributor

Sorry, got pulled away from this but taking another look.

Is it because I am doing this in separate steps?

No, that's what you should be doing. Everything you're doing looks right to me.

FWIW I think this issue is only manifesting with mac - https://github.com/damccorm/actions-playground/pull/3/checks?check_run_id=204886256.

Wondering if its related to one of these issues - https://stackoverflow.com/questions/49661521/how-to-update-npm-on-macos...

@bryanmacfarlane
Copy link
Member

If there was a setup-npm or npm-version input, it would just run the command above that appears to be failing on the mac for some reason. Steps do run out of process but it should be fine since that should change symlinks.

We don't have an npm-version property since (1) installing a node version by querying their json, happens to carry a version of npm and (2) if the version specified is different then it would just do npm -i npm@ver (so why not just do that)?

So I think the action item is to figure out why npm -i is not working on the mac image.

@bryanmacfarlane bryanmacfarlane changed the title Support npm-version npm install npm@version not working on the mac image Oct 16, 2019
@bryanmacfarlane bryanmacfarlane added the external Unexpected behavior was caused by external problems label Jun 30, 2020
@dmitry-shibanov
Copy link
Contributor

Hello everyone. Sorry for the late response. I've tried to reproduce the issue, but it looks like nodejs version setting up by the action works as expected. If you use nodejs version from hosted images you can try to upgrade npm version with this command: npm i -g npm --prefix=/usr/local/opt/node@14

For now I'm closing the issue. We have similar issue with adding npm-version input. If you have any concerns feel free to contact us.

krzyk pushed a commit to krzyk/setup-node that referenced this issue Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Unexpected behavior was caused by external problems
Projects
None yet
Development

No branches or pull requests

4 participants