NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.19k stars 14.2k forks source link

webpack CLI requires webpack-cli #42275

Open kwohlfahrt opened 6 years ago

kwohlfahrt commented 6 years ago

Issue description

I can't use nodePackages.webpack, as the CLI is split into webpack-cli, which is not available in nixpkgs.

Steps to reproduce

> nix run nixpkgs.nodePackages.webpack nixpkgs.nodePackages.npm
$ webpack
$ webpack 
The CLI moved into a separate package: webpack-cli
Would you like to install webpack-cli? (That will run npm install -D webpack-cli) (yes/NO)yes
npm WARN awesome-typescript-loader@5.1.1 requires a peer of typescript@^2.7 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-cli@3.0.8 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.
npm WARN react-nodes@0.0.1 No repository field.

+ webpack-cli@3.0.8
added 76 packages from 32 contributors in 9.471s
[+] no known vulnerabilities found [1180 packages audited]

{ Error: Cannot find module 'webpack-cli'
    at Function.Module._resolveFilename (module.js:476:15)
    at Function.Module._load (module.js:424:25)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at runCommand.then.result (/nix/store/x96639940sdbv2cpky54pf4xby51jvnl-node-webpack-4.8.3/lib/node_modules/webpack/bin/webpack.js:62:14)
    at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NOT_FOUND' }

Technical details

dywedir commented 5 years ago

Should be fixed with https://github.com/NixOS/nixpkgs/pull/51324 Please let me know if that isn't the case

pshirshov commented 3 years ago

Still broken.

Luflosi commented 2 years ago

This is preventing me from updating a different package (furo), since it now depends on webpack. I tried to fix webpack but didn't manage to do so. Maybe the NODE_PATH works differently to how it used to work?

Luflosi commented 2 years ago

I basically tried to edit pkgs/development/node-packages/default.nix and add

webpack-cli = super.webpack-cli.override {
  nativeBuildInputs = [ pkgs.makeWrapper ];
  postInstall = ''
    wrapProgram "$out/bin/webpack-cli" \
      --prefix NODE_PATH : ${self.webpack}/lib/node_modules
  '';
};

but it didn't work.

SkyLeite commented 1 week ago

This works for me

webpack-cli = pkgs.nodePackages.webpack-cli.override {
  nativeBuildInputs = [ pkgs.makeWrapper ];
  postInstall = ''
    wrapProgram "$out/bin/webpack-cli" \
      --set WEBPACK_PACKAGE ${pkgs.nodePackages.webpack}/lib/node_modules/webpack
  '';
};