[Nix-dev] Reengineered npm2nix: call for feedback

Paul Colomiets paul at colomiets.name
Tue Sep 30 20:55:39 CEST 2014


Hi,

On Tue, Sep 30, 2014 at 1:13 PM, Sander van der Burg
<svanderburg at gmail.com> wrote:
> Hopefully, you can also try npm2nix on your projects to find out whether
> there any additional issues. :)
>

If package.json doesn't contains "name" or "version" npm2nix, the
build fails with the following:

error: `buildNodePackage' at /tmp/react/node-env.nix:33:5 called
without required argument `version', at /tmp/react/registry.nix:5:27

It would be nicer, if npm2nix fails when generating nix files.

After I've filled both name and version I've got the following error:

> nix-build -A build
these derivations will be built:
  /nix/store/6g9vk21ag4rzjl13dnqnq3nabb1hgas0-node-reacttest-0.1.drv
building path(s)
`/nix/store/aksz62alq8903cnp88iv0z36n0lrybjh-node-reacttest-0.1'
building /nix/store/aksz62alq8903cnp88iv0z36n0lrybjh-node-reacttest-0.1
unpacking sources
unpacking source archive /nix/store/d394a7821m6sn02ymhvfa13c7dac2fiq-react
source root is react
patching sources
configuring
no configure script, doing nothing
building
installing
npm ERR! install Couldn't read dependencies
npm ERR! Error: Invalid version: "0.1"
npm ERR!     at Object.module.exports.fixVersionField
(/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-p$
ckage-data/lib/fixer.js:183:13)
npm ERR!     at
/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:30:38
npm ERR!     at Array.forEach (native)
npm ERR!     at normalize
(/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js$
29:15)
npm ERR!     at final
(/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/read-package-json/read-json.js:342:33)
npm ERR!     at then
(/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/read-package-json/read-json.js:126:33)
npm ERR!     at
/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/read-package-json/read-json.js:316:48
npm ERR!     at evalmachine.<anonymous>:207:20
npm ERR!     at OpenReq.Req.done
(/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:141:5)
npm ERR!     at OpenReq.done
(/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:61:22)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.15.5
npm ERR! command
"/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/bin/node"
"/nix/store/ih3sbklf4ncxgs84pdi34hq0lk8lrfwg-nodejs-0.10.32/bin/npm"
"--registry" "http://www.example.c$
m" "--nodedir=/nix/store/qf80rbp1rrcmhkibmia2p64gqd881yvx-node-sources"
"--production" "--ignore-scripts" "install"
npm ERR! cwd /nix/store/aksz62alq8903cnp88iv0z36n0lrybjh-node-reacttest-0.1/lib/node_modules/reacttest
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /nix/store/aksz62alq8903cnp88iv0z36n0lrybjh-node-reacttest-0.1/lib/node_modules/reacttest/npm-debug.log
npm ERR! not ok code 0
builder for `/nix/store/6g9vk21ag4rzjl13dnqnq3nabb1hgas0-node-reacttest-0.1.drv'
failed with exit code 1
error: build of
`/nix/store/6g9vk21ag4rzjl13dnqnq3nabb1hgas0-node-reacttest-0.1.drv'
failed

The package.json is as simple as:

{
    "name": "reacttest",
    "version": "0.1",
    "dependencies": {"react": "*"}
}


-- 
Paul


More information about the nix-dev mailing list