NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.35k stars 14.31k forks source link

gitmoji broken #266783

Closed Freed-Wu closed 11 months ago

Freed-Wu commented 1 year ago

Describe the bug

gitmoji broken.

Steps To Reproduce

Steps to reproduce the behavior:

❯ nix-env -iA nixos.gitmoji-cli
warning: name collision in input Nix expressions, skipping '/home/wzy/.local/state/nix/defexpr/channels_root/nixos'
suggestion: remove 'nixos' from either the root channels or the user channels
installing 'gitmoji-cli-8.5.0'
building '/nix/store/7g4ycm9c8bdq8345ww7a84by64mhrz3g-user-environment.drv'...
❯ gitmoji --help
(node:1067796) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/nix/store/dwj8812zz7a2kazadmcw138q5pdb1s9c-gitmoji-cli-8.5.0/lib/node_modules/gitmoji-cli/lib/cli.js:2
import meow from 'meow';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.18.2

Notify maintainers

~@dotlambda~ @NeQuissimus

dotlambda commented 1 year ago

I'm not a gitmoji-cli maintainer.

Buils fine on master. There's a reason we ask you to run nix-info.

Freed-Wu commented 1 year ago

Sorry to disturb you. I copy wrong name :cry:

@nequissimus

❯ nix-shell -p nix-info --run "nix-info -m"
these 4 paths will be fetched (0.39 MiB download, 8.47 MiB unpacked):
  /nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45
  /nix/store/azkk9647ivcaa29fpb8viwj879q7yjw4-gnu-config-2023-07-31
  /nix/store/bbxdw4rgwwl3gnajri82yidr1nlsfskf-stdenv-linux
  /nix/store/6g3mnziija245czxdqvs4k4sc6lad0sw-update-autotools-gnu-config-scripts-hook
copying path '/nix/store/azkk9647ivcaa29fpb8viwj879q7yjw4-gnu-config-2023-07-31' from 'https://mirrors.bfsu.edu.cn/nix-channels/store'...
copying path '/nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45' from 'https://mirrors.bfsu.edu.cn/nix-channels/store'...
copying path '/nix/store/6g3mnziija245czxdqvs4k4sc6lad0sw-update-autotools-gnu-config-scripts-hook' from 'https://mirrors.bfsu.edu.cn/nix-channels/store'...
copying path '/nix/store/bbxdw4rgwwl3gnajri82yidr1nlsfskf-stdenv-linux' from 'https://mirrors.bfsu.edu.cn/nix-channels/store'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.0, NixOS, 23.11 (Tapir), 23.11pre544052.85f1ba3e5167`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.1`
 - channels(wzy): `"json-c-0.16, librime-1.8.5"`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
dotlambda commented 1 year ago

Does https://github.com/NixOS/nixpkgs/pull/267167 help?

Freed-Wu commented 1 year ago

Still cannot:

❯ nix-env -iA nixos.gitmoji-cli
warning: name collision in input Nix expressions, skipping '/home/wzy/.local/state/nix/defexpr/channels_root/nixos'
suggestion: remove 'nixos' from either the root channels or the user channels
installing 'gitmoji-cli-9.0.0'
building '/nix/store/wkiyflb9adbv0f1fyr16p0d51xgvfim5-user-environment.drv'...
❯ gitmoji --version
(node:36784) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/nix/store/g06q0h9a9hb5zgm1vnpddi062hpy3hpa-gitmoji-cli-9.0.0/lib/node_modules/gitmoji-cli/lib/cli.js:2
import meow from 'meow';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.18.2
Freed-Wu commented 11 months ago

I think https://www.npmjs.com/package/meow should be packaged to NixOS to make gitmoji work.

dotlambda commented 11 months ago

I think https://www.npmjs.com/package/meow should be packaged to NixOS to make gitmoji work.

No, the dependency is already installed: ${gitmoji-cli}/lib/node_modules/gitmoji-cli/node_modules/meow exists.

Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.

The problem is that the derivation doesn't install package.json.