← Back to issue list

.npmrc can make snapcraft build failing

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1553056
Type
issue
State
closed
Author
~didrocks
Labels
—
Created
Updated
Closed

Current evaluation

Snapcraft 3.x addressed the failure through isolated build environments, preventing a user's ~/.npmrc prefix from redirecting npm-installed staged binaries.

Resolution: closed resolved

Reason: Maintainer ~sergiusens closed the report on 2019-08-07, noting that Snapcraft 3.x handles this through build environments. No specific resolving PR or commit was identified.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The guilty part was a .npmrc (created on some npm call) which was settling in: prefix=~/.node_modules This one makes the module installed in a different (non snapcraft-related path), and so the build is failing. ----- I'm trying to use the nodejs webchat example as our base nodejs minimal example. snapcraft master HEAD at 6d17a601d24b7053ffe92e3cb1d58e0bb9415a36. examples/webchat$ ../../bin/snapcraft Pulling webchat Building webchat npm install -g /home/didrocks/.node_modules/bin/webchat-for-a-snap -> /home/didrocks/.node_modules/lib/node_modules/webchat-for-a-snap/webchat.js webchat-for-a-snap@0.0.1 /home/didrocks/.node_modules/lib/node_modules/webchat-for-a-snap ├── express@4.13.4 (escape-html@1.0.3, array-flatten@1.1.1, cookie-signature@1.0.6, content-type@1.0.1, utils-merge@1.0.0, merge-descriptors@1.0.1, methods@1.1.2, vary@1.0.1, cookie@0.1.5, etag@1.7.0, content-disposition@0.5.1, fresh@0.3.0, path-to-regexp@0.1.7, range-parser@1.0.3, parseurl@1.3.1, serve-static@1.10.2, depd@1.1.0, qs@4.0.0, on-finished@2.3.0, finalhandler@0.4.1, debug@2.2.0, proxy-addr@1.0.10, send@0.13.1, type-is@1.6.12, accepts@1.2.13) └── socket.io@1.4.5 (has-binary@0.1.7, debug@2.2.0, socket.io-parser@2.2.6, socket.io-adapter@0.4.0, engine.io@1.6.8, socket.io-client@1.4.5) Staging webchat Stripping webchat [Errno 2] No such file or directory: '/home/didrocks/work/snappy/snapcraft/examples/webchat/snap/bin/webchat-for-a-snap' The issue I guess is coming from: /home/didrocks/.node_modules/bin/webchat-for-a-snap -> /home/didrocks/.node_modules/lib/node_modules/webchat-for-a-snap/webchat.js. It's not using the current example/stage directory. $ find . -name 'webchat*' ./parts/webchat ./parts/webchat/build/webchat.js ./webchat.js (not in install/) I don't have any local nodejs or npm installed in the PATH, I even removed ~/.node-modules to ensure this wasn't triggering some weird npm behavior.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Snapcraft 3.x addressed the failure through isolated build environments, preventing a user's ~/.npmrc prefix from redirecting npm-installed staged binaries.
stealth/space-bunny-alpha — closed resolved Snapcraft 3.x addressed the failure through its build environments; the issue was closed after a maintainer confirmed the legacy behavior was no longer applicable.
stealth/space-bunny-alpha — closed not a bug Closed without a Snapcraft fix: a user .npmrc set npm's global prefix to ~/.node_modules, redirecting installation outside the build staging directory.
qwen/qwen3.6-35b-a3b — — Closed without resolution. A .npmrc prefix setting redirected npm installs outside the snap environment, causing staging failures. No fix was implemented.
qwen/qwen3.6-35b-a3b — — Closed without resolution. A .npmrc file with a custom prefix caused snapcraft to fail staging by installing modules outside the build directory. No fix or maintainer response was provided.

Update history

Date Change
created

Related issues

No related issues found above the similarity threshold.