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 nodejs/node #1436

Closed
suzuki-shunsuke opened this issue Dec 17, 2021 · 6 comments · Fixed by #1437
Closed

Remove nodejs/node #1436

suzuki-shunsuke opened this issue Dec 17, 2021 · 6 comments · Fixed by #1437

Comments

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Dec 17, 2021

Why?

npm i -g doesn't work well.
When a command is installed by npm i -g, the command is installed at the same directory as npm.

$ npm install -g terminalizer
$ terminalizer --help        
zsh: command not found: terminalizer

$ ls /Users/shunsuke-suzuki/.aqua/pkgs/http/nodejs.org/dist/v17.2.0/node-v17.2.0-darwin-x64.tar.gz/node-v17.2.0-darwin-x64/bin
corepack  node  npm  npx  terminalizer

It is difficult to execute the command.

Breaking Change

nodejs/node is removed.

How to migrate

Install Node.js by the other way.

Note

We have to update the document too.

https://aquaproj.github.io/docs/tutorial-extras/use-aqua-with-other-tools

$ git grep nodejs
docs/tutorial-extras/use-aqua-with-other-tools.md:nodejs 17.2.0
docs/tutorial-extras/use-aqua-with-other-tools.md:- name: nodejs/[email protected]
docs/tutorial-extras/use-aqua-with-other-tools.md:nodejs 17.2.0
@suzuki-shunsuke
Copy link
Member Author

#2479

@airtonix
Copy link

airtonix commented Jan 4, 2024

unsure why this was done.

do we need a special shim type for handling the behaviour of npm?

@suzuki-shunsuke
Copy link
Member Author

There are several issues for npm support.

  1. aqua creates symbolic links for each command in the specific directory.

e.g.

$ which gh
/home/foo/.local/share/aquaproj-aqua/bin/gh 

So when we install tools with npm, we need to create symbolic links for tools, but it's difficult.
For example, if you install renovate-config-validator (Renovate) with npm, you need to create symbolic links of renovate and renovate-config-validator, but it's difficult.

npm i -g renovate
  1. aqua doesn't have information about npm packages.

When a command is executed, aqua searches the information about the command from aqua.yaml and registries.
But npm packages aren't managed by aqua, so aqua can't search them.

  1. aqua doesn't change shell environment variables

Unlike other tools such as nvm and pyenv, aqua doesn't change shell environment variables.
So aqua can't change the environment variable PATH dynamically.

@felipecrs
Copy link

How about adding the capability of adding environment variables to aquaproxy?

Maybe by checking if a file named {binaryname}.env is present at {packagedir} and loading from it before execing the program.

@W1M0R
Copy link

W1M0R commented Jul 16, 2024

If aqua could somehow configure the npm prefix, then it can control where npm install -g terminalizer would install global packages. I could imagine that the shim or aqua-proxy for npm could set an NPM environment variable that could temporarily modify the prefix setting for that process execution.

If the user needs to update their PATH to get to those installed modules, then maybe they can do something like "aqua root-dir/node_modules/bin" (or whatever makes sense). Alternatively, a new command could be introduced, perhaps aqua path that looks at the aqua.yaml file and the aqua root dir to generate a final path, e.g. PATH=aqua path:/usr/bin. The advantage of the aqua path approach is that it knows where the actual aqua.yaml version of node/npm lives and can have node_modules per installed version.

That could solve the issue of finding globally installed npm packages.

That said, installing npm packages globally goes against the reason we are using aqua in the first place, that is, to pin specific versions of packages on a per-project basis and to make it easy to activate that environment. So I think that the most preferred way to use this, would be for users to have a package.json that lists their npm packages and then they will just do a regular npm install which will create the node_modules folder in the project, and they will then run commands using npx. This specific use case shouldn't be a problem for aqua.

In this last mentioned approach, a user will have a aqua.yaml for their tools and a package.json for their npm packages, and then they will run:

aqua i -l
npm install
npx terminalizer

@suzuki-shunsuke
Copy link
Member Author

Thank you for your comment.
This issue is old and already closed, and Node Support is the issue of aqua itself rather than a specific package setting.
So I want to move the discussion to aquaproj/aqua#2996 .

@aquaproj aquaproj locked as resolved and limited conversation to collaborators Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants