← Back to issue list

nodejs plugin never runs install during pull

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1633298
Type
issue
State
closed
Author
~elopio
Labels
plugin
Created
Updated
Closed

Current evaluation

Fixed the nodejs plugin to run npm install during the pull phase by correcting the builddir path check, resolving downstream build failures.

Suggested action:

No scores available.

Issue body

In the nodejs plugin, in the _npm_install function, there are these statements: if os.path.exists(os.path.join(self.builddir, 'package.json')): self.run(npm_install) The _npm_install function is called twice, first in pull and later in build. As the path check uses the builddir, it will always be false during the pull phase. So on the pull phase, we are never running npm install. This manifests itself in a terrible way in the augur snap. It has an npm-run target, which should run after npm install. But during pull, npm install is not run so the other target runs without the prerequisites it needs. To reprodude: $ sudo apt install git snapcraft $ git clone https://github.com/elopio/augur $ cd augur $ git checkout snapcraft $ snapcraft

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Fixed the nodejs plugin to run npm install during the pull phase by correcting the builddir path check, resolving downstream build failures.
qwen/qwen3.6-35b-a3b Fixed by adjusting the nodejs plugin to check the source directory instead of the build directory, ensuring npm install runs during the pull phase.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#936 nodejs plugin: install during pull to support npm run snapcraft merged Merged a nodejs plugin update that installs dependencies during pull operations. This resolves npm run command failures by ensuring required packages are available. Approved by one reviewer and modified five files.
78%
#1652542 nodejs plugin does not download dependencies from package.json to the correct location snapcraft (launchpad) closed The nodejs plugin failed to download dependencies to the correct location due to a missing cwd argument. The author submitted a pull request to fix the oversight. The issue is closed, indicating the fix was merged and the bug resolved.
73%
#762 node plugin: run build in pull phase to download dependencies. snapcraft merged Merged. Relocates npm dependency installation to the pull phase and adds --cache-min=Infinity to enable offline builds. Replaces -g with --global. Verified offline functionality and approved.
71%
#2747 nodejs plugin: fix errors when building in confinement snapcraft merged Merged fix for nodejs plugin confinement build errors. Unsets SUDO_UID, applies --unsafe-perm to npm install, moves installation out of the pull step, and skips npm ls for yarn. Approved and merged.
70%