[Nix-dev] Reengineered npm2nix: call for feedback

Wout Mertens wout.mertens at gmail.com
Mon Oct 6 17:29:36 CEST 2014


Finally got around to testing this (on Darwin):

   - warn: was a bit confused when the `*nix-build -iA build*` didn't work
   in the git clone until I figured out I wasn't on the reengineered branch ;-)
   - wtf: I was working in a project with a pre-existing node_modules, and
   it was picking up things from there. So I did `*mv node_modules{,.foo}*`,
   and it *_still_* was picking up things from there. Then I did `*mv
   node_modules.foo wtf; chmod 0 wtf*` and it *_*still*_* was picking
   things from there. Huh? I ended up removing it but I'm still wondering what
   happened.
   - warn: I removed my old impure node install, ~/.npm and ~/.npmrc
   because they were interfering with npm2nix. After that things went fine.
   - bug: I noticed that it's asking the registry the same things a few
   times? In my case e.g.
   http://registry.npmjs.org/rimraf/%3E=2.2.0-0%20%3C2.3.0-0 comes back
   several times.
   - rfe: Would be nice if the registry requests were asynchronous, maybe 3
   at a time?
   - rfe: I'm not so happy with it overwriting default.nix... My use case
   is a project that uses grunt and some other things, so I want to have a
   default.nix that has all that defined for running nix-shell, and that means
   default.nix should not be overwritten...
   - rfe: Would be nice if default.nix included an environment definition
   to build (basically what nix-shell -A build does). That way there's a gc
   root to the result
   - notsureifbug: I can't build phantomjs because it can't find the ini
   module, fsevents because it can't find the NanNew definition in v8,
   node-[jpeg-tran-bin pngquant-bin optipng-bin gifsicle] because they can't
   find the stat-mode module. Problems with Darwin or module resolution in
   npm2nix?

For the rest, I <3 these changes, great work! +1 for pulling this into
npm2nix.

Wout.


On Fri, Oct 3, 2014 at 12:06 PM, Domen Kožar <domen at dev.si> wrote:

> Fantastic README, thanks for the hard work Sander!
>
> On Wed, Oct 1, 2014 at 10:40 AM, Sander van der Burg <
> svanderburg at gmail.com> wrote:
>
>> I haven't implemented any checks so far, but that could be improved. The
>> version number that you specified is actually not a valid semver version
>> specification. A version number should consist of 3 components. Also, I
>> could check for semver validity as well.
>>
>>
>> On Tue, Sep 30, 2014 at 8:55 PM, Paul Colomiets <paul at colomiets.name>
>> wrote:
>>
>>> 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
>>>
>>
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141006/64c16716/attachment-0001.html 


More information about the nix-dev mailing list