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 bin is removed in npm v9 #23

Open
ybiquitous opened this issue Sep 20, 2022 · 6 comments
Open

npm bin is removed in npm v9 #23

ybiquitous opened this issue Sep 20, 2022 · 6 comments

Comments

@ybiquitous
Copy link
Contributor

ybiquitous commented Sep 20, 2022

Hello. I notice the npm bin command will be removed in npm@9.0.0 when reading the release note of npm@9.0.0-pre.0.

This elisp package heavily depends on npm bin, so I worry the package will require some action in the future. Although, I have no good idea right now.

I hope this sharing will be of some help.

See also:

@ybiquitous
Copy link
Contributor Author

npm v9 has been released and will be latest on Nov 9, according to the announcement.

@ybiquitous
Copy link
Contributor Author

I've found the following workaround via npm exec, though the way may be a bit hacky:

(setq add-node-modules-path-command "npm exec --package=npm@8 -- npm bin")

@ybiquitous ybiquitous changed the title npm bin will be removed in npm@9.0.0 npm bin is removed in npm@9.0.0 Oct 25, 2022
@ybiquitous ybiquitous changed the title npm bin is removed in npm@9.0.0 npm bin is removed in npm v9 Oct 25, 2022
@codesuki
Copy link
Owner

Hey! Thanks for sharing. I didn't notice this issue at all, sorry.

That is unfortunate that they removed this command.
Before using npm bin we used to recursively look for a node_modules folder, but that also had issues.

Maybe until we find something people can at least refer to your workaround.

@ybiquitous
Copy link
Contributor Author

ybiquitous commented Nov 14, 2022

The following workaround using npm root may be better:

(setq add-node-modules-path-command "echo \"$(npm root)/.bin\"")

EDIT: Though this is still tricky.

@hyakt
Copy link

hyakt commented Jun 16, 2023

I used to be grateful for the workaround at #23 (comment), but now it seems that I need to set the following I have to configure it as follows.

(setq add-node-modules-path-command '("echo \"$(npm root)/.bin\"")))

@zach-delong
Copy link

I have also been using the workaround @hyakt mentions and that works fine for me on Linux. It didn’t work well on Windows, though (because the default shell is CMD still). It would probably make sense to use some elisp to concatenation in the .bin.

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