Talk:Node.js
yarn2nix not currently in nixpkgs
As of 11/2019, yarn2nix is not included in nixpkgs, however node2nix is. So perhaps the current yarn2nix section should be omitted, augmented/replaced with a section on node2nix, or the section on yarn2nix amended to indicate how to install it.
Actually, yarn2nix can be found under `pkgs.yarn2nix-moretea`, however i also think that `pkgs.nodePackages.node2nix` should be used. I am, however unsure how the path from node2nix to "deploy it on your nixos machine" is --Makefu (talk) 12:24, 26 February 2020 (UTC)
How to use mkYarnModules?
I just end up with a node_modules folder with no packages.
L0b0 (talk) 01:22, 30 August 2021 (UTC)
Building a custom nodejs version no longer works
I'm using the following shell.nix:
let pkgs = import ( fetchTarball { # TODO: Pin to stable nixpkgs name = "nixpkgs-2021-10-01"; url = "https://github.com/NixOS/nixpkgs/archive/9a23237031b385945132c8dac7d7ad97ece67408.tar.gz"; sha256 = "0g5ksps5pdhh1npv5vs6560gn0cdbvs536p54nm87lyvz50x7f6m"; }) { }; nodejsVersion = pkgs.lib.fileContents ./.nvmrc; buildNodeJs = pkgs.callPackage "${toString pkgs.path}/pkgs/development/web/nodejs/nodejs.nix" { }; nodejs = buildNodeJs { enableNpm = true; version = nodejsVersion; sha256 = "1vf989canwcx0wdpngvkbz2x232yccp7fzs1vcbr60rijgzmpq2n"; }; poetryEnv = pkgs.poetry2nix.mkPoetryEnv { python = pkgs.python38; projectDir = builtins.path { path = ./.; name = "geostore"; }; }; in pkgs.mkShell { buildInputs = [ nodejs poetryEnv poetryEnv.python.pkgs.pip poetryEnv.python.pkgs.poetry ]; shellHook = '' . activate-dev-env.bash ''; }
It fails to build with the following message:
../deps/v8/src/objects/js-list-format.cc: In static member function 'static v8::internal::MaybeHandle<v8::internal::JSListFormat> v8::internal::JSListFormat::New(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>)': ../deps/v8/src/objects/js-list-format.cc:146:67: error: 'static icu_69::ListFormatter* icu_69::ListFormatter::createInstance(const icu_69::Locale&, const char*, UErrorCode&)' is private within this context 146 | icu_locale, GetIcuStyleString(style_enum, type_enum), status); | ^ In file included from ../deps/v8/src/objects/js-list-format.cc:25: /nix/store/4z23hs6gmmz1iddi868w5dspq2az44wj-icu4c-69.1-dev/include/unicode/listformatter.h:267:27: note: declared private here 267 | static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode); | ^~~~~~~~~~~~~~ make[1]: *** [tools/v8_gypfiles/v8_base_without_compiler.target.mk:658: /build/node-v14.17.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/objects/js-list-format.o] Error 1 make[1]: *** Waiting for unfinished jobs.... rm 6d3cb5d5a2b0f84fdbbbd36684a9703f7a7dd7dc.intermediate e96e9872be5bcb367483eb7a95a7a0249169304f.intermediate 7814d936bef09600be94dabe6ae6c3fa051d2c04.intermediate make: *** [Makefile:104: node] Error 2 builder for '/nix/store/6rsgdc5n3slqfwl7a31f305valg24ig4-nodejs-14.17.0.drv' failed with exit code 2 error: build of '/nix/store/6rsgdc5n3slqfwl7a31f305valg24ig4-nodejs-14.17.0.drv' failed
I've tested with Node.js versions 14.17.0 and 14.18.0.