svanderburg / node2nix

Generate Nix expressions to build NPM packages
MIT License
527 stars 100 forks source link

`EACCES` / `CpyError` when building a `storybook` project #282

Open m-bock opened 2 years ago

m-bock commented 2 years ago

We're trying to use node2nix to build a node package that has a dependency to storybook.

node2nix sucessfully pulls all dependencies. however, when we run our build script like this:

pkgs.runCommand "mono" { buildInputs = [ pkgs.nodejs ]; } ''
    cd ${result.package}/lib/node_modules/circles-pink
    export OUTPUT_DIR=$out
    npm run build
  '';

we keep getting the following error:

error: builder for '/nix/store/fc419m39gw0q78ng79h820adaf26hhrh-mono.drv' failed with exit code 1;
       last 10 log lines:
       > ERR!     syscall: 'open',
       > ERR!     path: '/nix/store/nqfgxm0p4iv2jn8m9ry7n2rajdhsdc1f-mono/favicon.ico'
       > ERR!   },
       > ERR!   errno: -13,
       > ERR!   code: 'EACCES',
       > ERR!   syscall: 'open',
       > ERR!   path: '/nix/store/nqfgxm0p4iv2jn8m9ry7n2rajdhsdc1f-mono/favicon.ico',
       > ERR!   name: 'CpyError'
       > ERR! }
       > 
       For full logs, run 'nix log /nix/store/fc419m39gw0q78ng79h820adaf26hhrh-mono.drv'.

We're not sure if this is really related to node2nix, but maybe someone here has seen something like this. Would appreciate any hints!

Our package.json looks like this:

{
    "name": "circles-pink",
    "version": "1.0.0",
    "devDependencies": {
        "@babel/core": "^7.16.12",
        "babel-loader": "^8.2.3"
    },
    "dependencies": {
        "@storybook/addon-actions": "^6.4.14",
        "@storybook/addon-essentials": "^6.4.14",
        "@storybook/addon-links": "^6.4.14",
        "@storybook/react": "^6.4.14",
        "react": "^17.0.2",
        "react-dom": "^17.0.2"
    },
    "scripts": {
        "storybook": "start-storybook -p 6006",
        "build": "build-storybook --output-dir $OUTPUT_DIR"
    }
}