I am using node2nix for most of my projects by now for deployments as well as to provide the development environment. Since a recent update of nixpkgs I started to see the following error when I tried to enter the environment via nix-shell:

chmod: missing operand after 'u+w'
Try 'chmod --help' for more information.
builder for ‘/nix/store/rrhfrrdck10vwfcca5x99nhas9ff4n37-node-dependencies-project-0.1.0.drv’ failed with exit code 1
error: build of ‘/nix/store/rrhfrrdck10vwfcca5x99nhas9ff4n37-node-dependencies-project-0.1.0.drv’ failed
/Users/johannes/.nix-profile/bin/nix-shell: failed to build all dependencies

After a short investigation I found out that the issue originates from an outdated file nix-env.nix. This file was originally created by a run of node2nix. It provides auxiliary functions to build the node modules.

The following steps allowed me to fix it:

  1. Update node2nix to the latest version.

    An adjustment was made in the commit 232dfd9df259782ace4ffdb5c57cc06e0697ca4f inside of the node2nix repository.

  2. Remove your file node-env.nix.

  3. Run node2nix again. It will dump an updated node-env.nix and potentially also update your node-packages.nix.


The important changes are inside of the file node-env.nix. Depending on your needs you might not want to add the changes in node packages to your repository.

Afterwards things were working smooth again.


comments powered by Disqus