Closed JackHaeg closed 1 month ago
Updated issue with stack trace and ChatGPT read on the problem.
So building from the vite branch is also not working. Meaning we can't revert to earlier versions of the vite
branch changes in order to resolve this issue.
RESOLVED
@trillium @JackHaeg Hi all -- the 311-Data project is about to undergo a Vite migration from Webpack. Bonnie mentioned that your team ran into a blocker related to the merge. I've looked at the description for #1775, and I've reviewed the Files Changed... is there a write-up on what the build issue was and how this PR addressed it?
Happy to schedule a meeting if that's easier. Our dev team is just looking for further resources to make sure we don't run into any hiccups with our migration.
Hey @ryanfchase, a write-up is a great idea.
npm build
couldn't locate vite.config.js
vite.config.mjs
, no changenpm
had an updated version available
npm
within a docker containernode-18:slim
to node-20:alpine
in client/Dockerfile.prod
and that resolved our problemPrior to migrating to Vite we had a working build system, then maybe 2-3 weeks ago it started failing.
Hey @ryanfchase, a write-up is a great idea.
The short version:
- Build pipeline was working when we migrated to vite
- VRMS doesn't currently do a continuous build
- Manually triggered rebuild recently and the build failed, citing that then
npm build
couldn't locatevite.config.js
- Migrated to
vite.config.mjs
, no changeSaw a warning in the build system that
npm
had an updated version available
- Didn't know how to upgrade
npm
within a docker containerTried moving to a newer starting docker container. Not sure the technical term.
- Moved from
node-18:slim
tonode-20:alpine
inclient/Dockerfile.prod
and that resolved our problemPrior to migrating to Vite we had a working build system, then maybe 2-3 weeks ago it started failing.
Thank you! That's very insightful -- I've mentioned this in our migration ticket. We don't use docker to manage our frontend build, but we do have a CI pipeline through Github Actions. We'll have a look there to make sure we don't encounter a similar problem.
Overview
Currently the github action for the frontend rebuild is not working and needs to be investigated now that we have merged Vite. Until this issue is resolved, we cannot rebuild PROD or DEV
Action Items
Resources/Instructions
Error logs below
Chat GPT Explanation of issue
The error you're seeing during the build process is likely related to a problem with the native bindings for the `@swc/core` package, which is a core dependency of Vite for transforming JavaScript and TypeScript files. Here’s a breakdown of the issue: 1. **Failed to load native binding**: The key error here is `Failed to load native binding`, which suggests that the package `@swc/core` is trying to use a native module (likely compiled code), and it’s unable to find or load it properly. This could happen due to: - Mismatched Node.js version. - Corrupted `node_modules` folder. - The native module isn't installed or built properly. 2. **Potential causes**: - **Incorrect Node.js version**: Sometimes native bindings depend on specific versions of Node.js. You can check if your current version of Node.js matches the version supported by `@swc/core`. - **Corrupt `node_modules`**: The installation of the module may have been corrupted. Deleting the `node_modules` folder and reinstalling the dependencies can help. - **Missing dependencies**: If certain system-level dependencies for compiling the native bindings are missing, the package might fail to load. ### How to fix it: 1. **Reinstall dependencies**: - Try removing the `node_modules` folder and reinstalling the dependencies. ```bash rm -rf node_modules npm install ``` 2. **Ensure Node.js compatibility**: - Check your Node.js version and make sure it’s compatible with the version of `@swc/core`. You can check your version by running: ```bash node -v ``` If necessary, upgrade or downgrade Node.js using a tool like `nvm`. 3. **Update `@swc/core`**: - You might want to ensure you're using a compatible or latest version of `@swc/core` by running: ```bash npm install @swc/core ``` 4. **Rebuild native bindings**: - If the problem persists, try forcing a rebuild of native bindings: ```bash npm rebuild @swc/core ``` 5. **Clear npm cache** (if nothing else works): - Sometimes npm cache issues can cause build problems: ```bash npm cache clean --force ``` Once you've done the above steps, retry the build: ```bash npm run build ``` Let me know if this resolves the issue or if you're still encountering problems!