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

--global, --local are deprecated #515

Closed
2 of 5 tasks
raineorshine opened this issue Jun 12, 2022 · 2 comments
Closed
2 of 5 tasks

--global, --local are deprecated #515

raineorshine opened this issue Jun 12, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@raineorshine
Copy link

raineorshine commented Jun 12, 2022

Description:
On Windows Node v18.3.0, every time npm is spawned, I get the following warning printed to stderr:

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

This occurs not just when installing dependencies and running tests within a job, but also whenever npm is spawned within any of those tests. This is causing a failure in npm-check-updates tests that rely on stderr to be completely empty: https://github.com/raineorshine/npm-check-updates/runs/6850288596?check_suite_focus=true#step:6:471.

Action version:
Specify the action version: v3.1.0

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

node v18.3.0

Repro steps:
A description with steps to reproduce the issue. If you have a public example or repo to share, please provide the link.

https://github.com/raineorshine/npm-check-updates/runs/6850288596?check_suite_focus=true#step:6:471

Expected behavior:
On Windows 18, npm should be configured to not use the deprecated --global and --local options, and no warning should be shown.

Actual behavior:
The warning is printed to stderr any time npm is run on the host machine:

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

In the failed Github action, you can see the warnings printed in both setup and npm install, before any user tests are run:

Run actions/setup-node@v3.1.0
Attempting to download 18...
Acquiring 18.3.0 - x64 from https://github.com/actions/node-versions/releases/download/18.3.0-2426429734/node-18.3.0-win32-x64.7z
Extracting ...
Adding to the cache ...
Done
C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\18.3.0\x64\npm.cmd config get cache"
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
C:\npm\cache
npm cache is not found

During npm install:

Run npm ci
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

Notes:

  • I have searched existing issues
  • I have confirmed that all instances of --global and --local have been removed from the npm-check-updates codebase. It seems to be coming from the npm config installed by setup-node.
  • The issue does not occur on Ubuntu.
@IvanZosimov
Copy link
Contributor

Hi, @raineorshine 👋 ! Thank you for the issue. Here you encountered the well known bug of npm. At that moment this bug is fixed in npm 8.12.1, but this version still isn't bundled with the LTS and Current (16.x and 18.x) versions of the node.js. As soon as the mentioned versions of node.js get updated, your workflow will start to perform normally. By now, I suggest you to use this workaround which can be inserted into your workflow right after the setup-node step.

        if: ${{ (matrix.node == '16' || matrix.node == '18') && matrix.os == 'windows-latest' }}
        run: |
           $WhereNode = Get-Command node | Select-Object -ExpandProperty Definition
           $NodeDirPath = Split-Path $WhereNode -Parent
           cd $NodeDirPath
           npm install npm@8.12.1

Don't forget to delete it after the new version of node.js is revealed.

By now, I'm closing this issue, If you have any questions or suggestions feel free to ping us.

@raineorshine
Copy link
Author

Great, thank you for the explanation and workaround!

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.1.3 to 5.1.6.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants