Closed msakrejda closed 3 years ago
This might be specific to the fact that the process crashed.
The error message logic will use a more concise message if an error is recorded.
Please provide replication steps that can cause the "build with vite failed" condition to be printed, while at the same time not writing the last build metadata with success: false
.
I tried to come back to this to debug further, but I moved to a new laptop in the meantime, and can no longer reproduce the issue. I'm going to close this for now, but maybe the info above is useful if someone else hits something similar.
bundle update vite_ruby
.Description π
When running Rails feature specs that require asset precompilation, if asset compilation fails (which can happen but doesn't appear to produce any output in the test), vite_ruby will cause template errors in looking up the assets, but the guidance is misleading:
In this case, everything was set up correctly, but we were simply running out of configured memory for node, so the asset build did not complete, and no manifest file was generated. See "Logs" section for details. Ideally, I think vite_ruby could inform the user that the asset build failed and show the underlying cause or give some troubleshooting information.
Reproduction π
I'm not able to generate a minimal reproduction right now or share the project I'm working on. I hope the information above is still useful.
Vite Ruby Info
_Run `bin/rake vite:info` and provide the output:_ ``` bin/vite present?: false vite_ruby: 3.0.0 vite_rails: 3.0.0 rails: node: v14.16.0 npm: 7.12.1 yarn: 1.22.5 pnpm: ruby: ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux] installed packages: pganalyze@1.0.0 /home/maciek/duboce-labs/pganalyze βββ¬ vite-jest@0.0.3 β βββ vite@2.5.10 deduped βββ¬ vite-plugin-mdx@3.5.6 β βββ vite@2.5.10 deduped βββ¬ vite-plugin-ruby@3.0.1 β βββ vite@2.5.10 deduped βββ vite@2.5.10 ```Logs π
If not providing a reproduction:
Output
_Run `DEBUG=vite-plugin-ruby:* bin/vite dev` or `DEBUG=vite-plugin-ruby:* bin/vite build` and provide the output:_ In this case, I think the output of invoking `resolve_entries` directly is more relevant: I've included that below. Note that the warnings below "rendering chunks" are repeated a few times (the sourcemap warning is repeated a lot). I've omitted the duplicates for readability. I don't think the warnings relevant to this problem, but I'm including them just in case I'm misunderstanding this. (I do intend to investigate and address these but wanted to report this issue now.) ``` [7] pry(main)> ViteRuby.instance.manifest.resolve_entries('application', type: :typescript) Building with Vite β‘οΈ vite v2.5.10 building for test... transforming... β 3004 modules transformed. rendering chunks... Error when using sourcemap for reporting an error: Can't resolve original location of error. Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade` [BABEL] Note: The code generator has deoptimised the styling of /home/maciek/project/node_modules/react-dom/cjs/react-dom.development.js as it exceeds the max of 500KB. [plugin:inject] rollup-plugin-inject: failed to parse /home/maciek/project/app/javascript/styles/global/index.scss. Consider restricting the plugin to particular files via options.include 'unix' is not exported by 'node_modules/moment/dist/moment.js' 'duration' is not exported by 'node_modules/moment/dist/moment.js' <--- Last few GCs ---> [665987:0x62ee0c0] 101065 ms: Mark-sweep (reduce) 2036.0 (2051.9) -> 2034.9 (2054.0) MB, 1709.3 / 0.1 ms (average mu = 0.418, current mu = 0.035) allocation failure scavenge might not succeed [665987:0x62ee0c0] 103846 ms: Mark-sweep (reduce) 2035.3 (2055.0) -> 2035.2 (2055.2) MB, 2412.5 / 0.1 ms (average mu = 0.279, current mu = 0.132) allocation failure GC in old space requested <--- JS stacktrace ---> FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory 1: 0xa04200 node::Abort() [node] 2: 0x94e4e9 node::FatalError(char const*, char const*) [node] 3: 0xb7978e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0xb79b07 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0xd34395 [node] 6: 0xd64f2e v8::internal::EvacuateNewSpaceVisitor::Visit(v8::internal::HeapObject, int) [node] 7: 0xd70f66 v8::internal::FullEvacuator::RawEvacuatePage(v8::internal::MemoryChunk*, long*) [node] 8: 0xd5d14f v8::internal::Evacuator::EvacuatePage(v8::internal::MemoryChunk*) [node] 9: 0xd5d3c8 v8::internal::PageEvacuationTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [node] 10: 0xd4fca9 v8::internal::ItemParallelJob::Run() [node] 11: 0xd72ec0 void v8::internal::MarkCompactCollectorBase::CreateAndExecuteEvacuationTasksWe found this StackOverflow discussion, set the env var suggested there, and now the build completes.
Screenshots π·
Provide console or browser screenshots of the problem.
N/A