← 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

Bug where the nodejs plugin skipped npm install during pull (builddir check always false) was fixed by merged PR snapcore/snapcraft#936 (commit 0497daaac), which installs dependencies during pull.

Resolution: closed resolved

Reason: Maintainer ~sergiusens closed the bug on 2016-11-30 pointing to GitHub PR snapcore/snapcraft#936, which was merged as commit 0497daaac. The change moves npm dependency installation into the pull phase so npm run targets have their prerequisites.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved Bug where the nodejs plugin skipped npm install during pull (builddir check always false) was fixed by merged PR snapcore/snapcraft#936 (commit 0497daaac), which installs dependencies during pull.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#936 (commit 0497daaac), moving Node.js dependency installation into pull so npm run targets have their prerequisites.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #936 (commit 0497daaac), which runs npm install during pull so npm-run targets have their dependencies.
stealth/space-bunny-alpha — closed resolved Fixed in canonical/snapcraft#936 (commit 0497daaac): the Node.js plugin now runs npm install during pull, ensuring npm-run targets have their dependencies.
stealth/space-bunny-alpha — closed resolved Fixed in merged PR canonical/snapcraft#936 (commit 0497daaac): the Node.js plugin now runs npm install during pull so npm run targets have their dependencies.
stealth/space-bunny-alpha — closed resolved Fixed by merging canonical/snapcraft#936 (commit 0497daaac), which runs npm install during pull so npm run targets have their dependencies.
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

Date Change
created

Related work

  • Likely Fixed By: canonical/snapcraft#936 (confidence 97%)

    Cited in the maintainer's closing comment and merged as commit 0497daaac; installs Node.js dependencies during pull.

Related issues

Issue Project State Summary Similarity
#936 nodejs plugin: install during pull to support npm run snapcraft merged Merged in snapcraft#936 (commit 0497daaac), installing Node.js dependencies during pull so npm run commands can access them.
82%
#1652542 nodejs plugin does not download dependencies from package.json to the correct location snapcraft (launchpad) closed Reported that the nodejs plugin omitted cwd when installing package.json deps. Fixed by snapcore/snapcraft PR #1023, merged to snapcraft as commit d3b476573 ("nodejs plugin: fix the plugin's dependency installation").
77%
#1612005 The nodejs plugin downloads packages during the build snapcraft (launchpad) closed Closed in 2019 after the maintainer noted the plugin was no longer supported; no closing PR was cited. Earlier pull-phase npm work appeared in snapcore/snapcraft#936.
71%
#1623509 nodejs plugin does not download dependencies from package.json snapcraft (launchpad) closed Fixed in merged PR #800 via commit ced6edd9c: the Node.js plugin now installs package.json devDependencies during the build phase.
70%