!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

208 Members
58 Servers

Load older messages


SenderMessageTime
9 Nov 2023
@lily:lily.flowersLily Foster
In reply to @szucsitg:matrix.org
Thanks for debugging. I was looking through the yarn2nix code, and I think I found a work around. Use the tag's source tar.gz from github
Those tarballs aren't exactly guaranteed to never change (and indeed they have in the past) so that might explode some dahy
16:46:54
@lily:lily.flowersLily Foster
In reply to @szucsitg:matrix.org
Thanks for debugging. I was looking through the yarn2nix code, and I think I found a work around. Use the tag's source tar.gz from github
* Those tarballs aren't exactly guaranteed to never change (and indeed they have in the past) so that might explode some day
16:46:55
@lily:lily.flowersLily FosterLetting yarn2nix download it as a git repo is probably better16:47:05
@lily:lily.flowersLily Foster And it looks like they should support git+https://github.com/duosecurity/duo_web_sdk.git#v2.9 correctly 16:47:29
@szucsitg:matrix.orgszucsitgLet me try this16:48:02
@szucsitg:matrix.orgszucsitgIt's working 🥳 now i can continue fixing missing package references in our own packages 😅16:55:39
@szucsitg:matrix.orgszucsitgThanks again for your help 🙂16:55:48
@lily:lily.flowersLily Fosteroh good! glad it was that easy to fix16:58:37
@szucsitg:matrix.orgszucsitg The next one will be more difficult because our own packages are not in the lock file 17:02:30
10 Nov 2023
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de Soooo Lily Foster I found my issue. The lock file was too old. Is this issue known in nix-prefetch-npm? 09:11:03
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deIssue is that the downloads just deadlock at some point09:11:21
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deFull reproducer with the original files: https://github.com/dasJ/broken-npm-test09:20:23
@lily:lily.flowersLily Foster
In reply to @janne.hess:helsinki-systems.de
Full reproducer with the original files: https://github.com/dasJ/broken-npm-test
Spooky, i'll try your reproducer later and see what's up
12:21:05
@szucsitg:matrix.orgszucsitgI managed to figure out how to build the project mkYarnPackage. I added all packagges as workspaceDependencies, and it displays correctly in the offline cache derivation under node-modules (symlinked from deps). However when I want to build the React frontend a few folders down, it cannot find our own packages, while the node_modules folder correctly symlinked in root to offlineCache.16:14:45
@szucsitg:matrix.orgszucsitg* I managed to figure out how to build the project mkYarnPackage. I added all packagges as workspaceDependencies, and it displays correctly in the offline cache derivation under node-modules (symlinked from deps). However when I want to build the React frontend a few folders down, it cannot find our own packages, while the node_modules folder correctly symlinked in root to offlineCache. Anybody seen such behavior?16:15:00
@lily:lily.flowersLily Foster
In reply to @szucsitg:matrix.org
I managed to figure out how to build the project mkYarnPackage. I added all packagges as workspaceDependencies, and it displays correctly in the offline cache derivation under node-modules (symlinked from deps). However when I want to build the React frontend a few folders down, it cannot find our own packages, while the node_modules folder correctly symlinked in root to offlineCache.
i really think trying to symlink node_modules like that is gonna cause more problems than it will solve
16:15:30
@lily:lily.flowersLily Fosterwhat's in that "few folders down" you're referring to?16:15:44
@lily:lily.flowersLily Foster(e.g. a new yarn package entirely or workspace package or what?)16:15:58
@szucsitg:matrix.orgszucsitg So I've got a project/yarn.lock which is root and the package.json for the frontend to built is under project/web/app 16:17:18
@szucsitg:matrix.orgszucsitgI'm open to other suggestion then symlink node-modules in configurePhase16:18:09
@szucsitg:matrix.orgszucsitg* I'm open to other suggestion than symlink node-modules in configurePhase16:18:17
@lily:lily.flowersLily Fosterbut you aren't using workspace packaging then?16:18:29
@lily:lily.flowersLily Fosterjust separate yarn packages entirely?16:18:35
@szucsitg:matrix.orgszucsitg I have a derivation as mkYarnPackage, which uses fetchYarnDeps to populate offline cache. And I'm also adding workspace dependencies by iterating through a couple of folders and generating them with mkYarnPackage and inheriting yarnLock and offlineCache 16:20:40
@szucsitg:matrix.orgszucsitgAlso without symlinking the node_modules in configurePhase the derivation build fail that it cannot unlink folders as they're not empty16:25:56
@szucsitg:matrix.orgszucsitg

Like this:


error: builder for '/nix/store/2wh00drgf8sxhx6k8z7sx9fsbw35jb4y-account-settings-modules-1.0.0.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/9xvqxvm2hr9dq1d487zww0zywmnaa007-account-settings-1.0.0.drv' failed to build
error (ignored): error: cannot unlink '/private/tmp/nix-build-accept-shared-modules-1.0.0.drv-6/yarn_home/Library/Caches/Yarn/v6/npm-core-js-3.31.0-4471dd33e366c79d8c0977ed2d940821719db344-integrity/node_modules/core-js/internals': Directory not empty
error (ignored): error: cannot unlink '/private/tmp/nix-build-web-client-modules-4.123.0.drv-0/yarn_home/Library/Caches/Yarn/v6/npm-core-js-pure-3.31.0-052fd9e82fbaaf86457f5db1fadcd06f15966ff2-integrity/node_modules/core-js-pure/modules': Directory not empty
error: 1 dependencies of derivation '/nix/store/6il46rk23vm78ly4n5fiv63dghb6mh7d-frontend.drv' failed to build
16:28:08
@peter-lustig:matrix.orgpeter-lustig

Lily Foster: could you help me with packaging my nodejs app? These are the requirements:


You will need the output directory, the project's package.json, and the production dependencies in node_modules to run the application. Production dependencies can be generated by copying the package.json and package-lock.json and then running npm ci --omit dev (you can skip this step if your app doesn't have any dependencies). You can then start your app with this command:

node build
Development dependencies will be bundled into your app using Rollup. To control whether a given package is bundled or externalised, place it in devDependencies or dependencies respectively in your package.json.

This is what I have:

buildInputs = with pkgs; [
        nodejs_20
      ];
      src = ./.;
      npmDepsHash = "sha256-mTpjBKTIJkYVj2jrH5lF/n3Axceak4L60ZDQECQhGew=";
      npmBuild = "npm run build";
      npmInstallFlags = [ "--omit dev" ];
      installPhase = ''
        mkdir $out
        cp -r build/* $out
        cp package.json $out
        cp package-lock.json $out
      '';
22:26:37
@peter-lustig:matrix.orgpeter-lustig *

Lily Foster: could you help me with packaging my nodejs app? These are the requirements:

*First,

You will need the output directory, the project's package.json, and the production dependencies in node_modules to run the application. Production dependencies can be generated by copying the package.json and package-lock.json and then running npm ci --omit dev (you can skip this step if your app doesn't have any dependencies). You can then start your app with this command:

node build
Development dependencies will be bundled into your app using Rollup. To control whether a given package is bundled or externalised, place it in devDependencies or dependencies respectively in your package.json.*

This is what I have:

buildInputs = with pkgs; [
        nodejs_20
      ];
      src = ./.;
      npmDepsHash = "sha256-mTpjBKTIJkYVj2jrH5lF/n3Axceak4L60ZDQECQhGew=";
      npmBuild = "npm run build";
      npmInstallFlags = [ "--omit dev" ];
      installPhase = ''
        mkdir $out
        cp -r build/* $out
        cp package.json $out
        cp package-lock.json $out
      '';
22:26:53
@peter-lustig:matrix.orgpeter-lustig I think there are already few faults in there, but this is the first error I have:
sh: line 1: vite: command not found
22:27:56
@peter-lustig:matrix.orgpeter-lustig(build is output directory, just to give context)22:28:40

Show newer messages


Back to Room ListRoom Version: 6