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

Remove usages of npm bin #710

Merged
merged 2 commits into from
Dec 7, 2023
Merged

Remove usages of npm bin #710

merged 2 commits into from
Dec 7, 2023

Conversation

pradeepnschrodinger
Copy link
Collaborator

Description

npm bin has been removed in npm v9 and above.
See v9 docs:

npm bin has been removed (use npx or npm exec to execute binaries)

Motivation and Context

Some of our scripts still reference npm bin (see #708), so it causes failures.
This fixes #708.

How Has This Been Tested?

Test locally by running npm run site-dev-server and npm run site-build.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

@@ -1,6 +1,5 @@
#!/bin/bash
set -e
PATH=$(npm bin):$PATH
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this the npm bin path was added so that the commands below (like webpack) can be executed.

So I initially planned on using npx or npm exec to execute them, but it turns out that these are no longer required.

As per the docs for npm run:

In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix.

@AmanGupta2708
Copy link
Collaborator

LGTM

@pradeepnschrodinger pradeepnschrodinger merged commit 5a0065d into master Dec 7, 2023
6 checks passed
@pradeepnschrodinger pradeepnschrodinger deleted the replace-npm-bin branch December 7, 2023 12:35
@pradeepnschrodinger
Copy link
Collaborator Author

Released with v2.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"site-dev-server" script doesn't work after upgrading to npm 9.8.0
3 participants