.npmrc can make snapcraft build failing

Bug #1553056 reported by Didier Roche-Tolomelli
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Won't Fix
Medium
Sergio Schvezov

Bug Description

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.

description: updated
summary: - nodejs webchat examples doesn't work
+ .npmrc can make snapcraft build failing
description: updated
Changed in snapcraft:
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 2.7
importance: Undecided → Medium
Changed in snapcraft:
milestone: 2.7 → none
Changed in snapcraft:
status: New → Triaged
Revision history for this message
Cheng Lu (dawndiy) wrote :
Download full text (4.1 KiB)

This problem also affects me.

My .npmrc file is:
```
prefix=/home/dawndiy/.node
```

Use snapcraft to build this project 'https://github.com/dawndiy/electronic-wechat-snap'.

-----------------BUILD LOG-------------------
Downloading 'node-v4.4.4-linux-x64.tar.gz'[===============================================================================================================================================================================] 100%
npm --cache-min=Infinity install
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
-
> electron@1.4.15 postinstall /home/dawndiy/workspace/ubuntu-snappy/wechat1/parts/electronic-wechat/src/node_modules/electron
> node install.js

> nodejieba@2.2.4 install /home/dawndiy/workspace/ubuntu-snappy/wechat1/parts/electronic-wechat/src/node_modules/pinyin/node_modules/nodejieba
> node-gyp rebuild

make: Entering directory '/home/dawndiy/workspace/ubuntu-snappy/wechat1/parts/electronic-wechat/src/node_modules/pinyin/node_modules/nodejieba/build'
  CXX(target) Release/obj.target/nodejieba/lib/index.o
  CXX(target) Release/obj.target/nodejieba/lib/nodejieba.o
  SOLINK_MODULE(target) Release/obj.target/nodejieba.node
  COPY Release/nodejieba.node
make: Leaving directory '/home/dawndiy/workspace/ubuntu-snappy/wechat1/parts/electronic-wechat/src/node_modules/pinyin/node_modules/nodejieba/build'
electron-packager@7.7.0 node_modules/electron-packager
├── rcedit@0.5.1
├── run-series@1.1.4
├── minimist@1.2.0
├── electron-osx-sign@0.3.2
├── debug@2.6.0 (ms@0.7.2)
├── resolve@1.2.0
├── extract-zip@1.6.0 (debug@0.7.4, yauzl@2.4.1, mkdirp@0.5.0, concat-stream@1.5.0)
├── get-package-info@0.1.1 (lodash.get@4.4.2, bluebird@3.4.7)
├── fs-extra@0.30.0 (path-is-absolute@1.0.1, jsonfile@2.4.0, graceful-fs@4.1.11, klaw@1.3.1, rimraf@2.5.4)
├── asar@0.12.4 (chromium-pickle-js@0.2.0, commander@2.9.0, minimatch@3.0.3, glob@6.0.4, tmp@0.0.28, mkdirp@0.5.1, cuint@0.2.2, mksnapshot@0.3.0)
├── electron-download@2.2.1 (path-exists@1.0.0, home-path@1.0.3, rc@1.1.6, mkdirp@0.5.1, mv@2.1.1, nugget@1.6.2)
└── plist@1.2.0 (util-deprecate@1.0.2, base64-js@0.0.8, xmldom@0.1.27, xmlbuilder@4.0.0)

electron@1.4.15 node_modules/electron
├── extract-zip@1.6.0 (debug@0.7.4, yauzl@2.4.1, mkdirp@0.5.0, concat-stream@1.5.0)
└── electron-download@3.2.0 (semver@5.3.0, home-path@1.0.3, minimist@1.2.0, rc@1.1.6, debug@2.6.0, path-exists@2.1.0, sumchecker@1.3.0, fs-extra@0.30.0, nugget@2.0.1)

pinyin@2.8.0 node_modules/pinyin
├── object-assign@4.1.1
├── commander@1.1.1 (keypress@0.1.0)
└── nodejieba@2.2.4 (nan@2.3.5)
npm --cache-min=Infinity install --global
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
-
> electron@1.4.15 postinstall /home/dawndiy/.node/lib/node_modules/electronic-wechat/node_modules/electron
> node install.js

> nodejieba@2.2.4 install /home/dawndiy/.node/lib/node_modules/electronic-wechat/node_modules/pinyin/node_modules/nodejieba
> node-gyp rebuild

make: Entering directory '/home/dawndiy/.node/lib/node_modules/electronic-wechat/node_modules/pinyin/node_modules/nodejieba/build'
  CXX(target) Release/obj.target/nodejieba/lib/index.o
  CXX(target) Release/obj.target/nodejieba/lib/nodejieba.o
  SOLINK_MODULE(target)...

Read more...

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

3.x takes care of this with its build environments

Changed in snapcraft:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.