Nix NodeJS | 208 Members | |
| 60 Servers |
| Sender | Message | Time |
|---|---|---|
| 10 Nov 2023 | ||
| Full reproducer with the original files: https://github.com/dasJ/broken-npm-test | 09:20:23 | |
In reply to @janne.hess:helsinki-systems.deSpooky, i'll try your reproducer later and see what's up | 12:21:05 | |
| 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. | 16:14:45 | |
| * 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 | |
In reply to @szucsitg:matrix.orgi really think trying to symlink node_modules like that is gonna cause more problems than it will solve | 16:15:30 | |
| what's in that "few folders down" you're referring to? | 16:15:44 | |
| (e.g. a new yarn package entirely or workspace package or what?) | 16:15:58 | |
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 | |
| I'm open to other suggestion then symlink node-modules in configurePhase | 16:18:09 | |
| * I'm open to other suggestion than symlink node-modules in configurePhase | 16:18:17 | |
| but you aren't using workspace packaging then? | 16:18:29 | |
| just separate yarn packages entirely? | 16:18:35 | |
| 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 | |
| Also without symlinking the node_modules in configurePhase the derivation build fail that it cannot unlink folders as they're not empty | 16:25:56 | |
| Like this: | 16:28:08 | |
| Lily Foster: could you help me with packaging my nodejs app? These are the requirements:
This is what I have:
| 22:26:37 | |
| * 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 This is what I have:
| 22:26:53 | |
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 | |
| (build is output directory, just to give context) | 22:28:40 | |
In reply to @peter-lustig:matrix.orgI don't think npmBuild is doing anything there (it's not a valid arg?) and npm install implicitly has --omit=dev, but what that will do is prune dev dependencies (like vite) also when installing deps... | 22:30:04 | |
If you want to prune deps, you should npm prune --omit=dev yourself | 22:30:33 | |
| wait the more i'm reading this the less sense it makes | 22:31:44 | |
| are you able to share more info on the npm package itself? | 22:31:55 | |
In reply to @lily:lily.flowersThis is what I am following now, just trying to do that stuff with nix: https://kit.svelte.dev/docs/adapter-node#deploying | 22:32:23 | |
| (and you shouldn't need modules if you use rollup, right?) | 22:32:29 | |
i'm pretty sure buildNpmPackage will do the right thing without trying to recreate what these docs are suggesting | 22:33:24 | |
you might just need to add build as a dir for npm package in your package.json | 22:33:35 | |
| and then it should handle everything else | 22:33:42 | |
| * and then buildNpmPackage should handle everything else | 22:33:47 | |
In reply to @lily:lily.flowersso what could I omit in buildNpmPackage? | 22:34:03 | |