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

add npm and update prefix location #1527

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kranurag7
Copy link

  • out of the box npm is not installed with nodejs so pipeline cannot be used as of now.

  • prefix was once changed before via prefix should be /usr #863 but if we go with /usr then npm is not able to detect the installs. It is looking for installed deps under /usr/local/lib/node_modules but this pipelines installs things under /usr/lib/node_modules

/ # npm root -g
/usr/local/lib/node_modules
/ # npm install vite -g

added 10 packages in 3s

3 packages are looking for funding
  run `npm fund` for details
/ # ls /usr/local/lib/node_modules/
vite

In wolfi, some npm install are using -prefix ${{targets.destdir}}/usr/local/ prefix.
ref: https://github.com/wolfi-dev/os/blob/16217a5581667f12cc28a592eef03fec13f98ffb/lerna.yaml#L28 and https://github.com/wolfi-dev/os/blob/16217a5581667f12cc28a592eef03fec13f98ffb/renovate.yaml#L29

but some are also using -prefix ${{targets.destdir}}/usr
ref: https://github.com/wolfi-dev/os/blob/16217a5581667f12cc28a592eef03fec13f98ffb/playwright.yaml#L23

thinking about it from placing binary perspective, it makes sense that we choose /usr because we put most binaries in /usr/bin but if we go with /usr/local as well then that should be good as well considering it's there in PATH.

/ # echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

from libraries perspective, for e.g. while packaging express, we need to use /usr/local considering npm root -g

@kranurag7
Copy link
Author

test failure seems unrelated to this change.

 2024/10/02 08:56:05 INFO /usr/bin/python3.12 -c "from setuptools import version": PASS uses=python/import
FAIL:  py3-pandas-test.yaml
make: *** [Makefile:155: test-e2e] Error 1
Error: Process completed with exit code 2.

pkg/build/pipelines/npm/install.yaml Outdated Show resolved Hide resolved
Signed-off-by: kranurag7 <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants