When I run modulizer --out . I get the following error:
C:\me\myProject>modulizer --out .
[1/2] 锟斤拷 Converting Package...
Out directory: C:\me\myProject
<--- Last few GCs --->
[20284:000002000B7E6970] 98725 ms: Mark-sweep 1331.6 (1461.2) -> 1331.5 (1461.7) MB, 1729.7 / 0.0 ms allocation failure GC in old space requested
[20284:000002000B7E6970] 100165 ms: Mark-sweep 1331.5 (1461.7) -> 1331.5 (1426.2) MB, 1438.9 / 0.0 ms last resort GC in old space requested
[20284:000002000B7E6970] 101887 ms: Mark-sweep 1331.5 (1426.2) -> 1331.5 (1426.2) MB, 1721.4 / 0.0 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 00000323F3BA57C1 <JSObject>
1: stringSlice(aka stringSlice) [buffer.js:560] [bytecode=000001E4864E4D19 offset=94](this=00000145C76822D1 <undefined>,buf=000003B2A364ABF1 <Uint8Array map = 0000039A83F43231>,encoding=00000323F3BB4EB1 <String[4]: utf8>,start=0,end=511355)
2: oncomplete(aka readFileAfterClose) [fs.js:~489] [pc=000003A4F9AF91C2](this=000002D4084D79B1 <FSReqWrap map = 0000003B0AD34B89>,err=00000145C7682...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node_module_register
2: v8::internal::FatalProcessOutOfMemory
3: v8::internal::FatalProcessOutOfMemory
4: v8::internal::Factory::NewRawOneByteString
5: v8::internal::Factory::NewStringFromOneByte
6: v8::internal::Factory::NewStringFromUtf8
7: v8::String::NewFromUtf8
8: v8_inspector::V8InspectorClient::currentTimeMS
9: node::Buffer::New
10: v8::internal::wasm::SignatureMap::Find
11: v8::internal::Builtins::CallableFor
12: v8::internal::Builtins::CallableFor
13: v8::internal::Builtins::CallableFor
14: 000003A4F99843C1
+1 Same exact error when running #master.
See this document, especially max_old_space_size=8192 to allocate memory. Or consider converting smaller amount of components.
I installed the Linux subsystem on my windows development box (ubnuntu from the windows store), then node.js polymer-cli etc.
I could then run Modiulizer without any memory/speed errors on my app.
@web-padawan In git-bash setting NODE_OPTIONS="--max_old_space_size=8192" doesn't change anything, still crashing.
@davie-robertson How did you get it working in WSL? I just get this error:
$ modulizer --version
Error: Cannot find module '../lib/cli/index'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/node_modules/polymer-modulizer/bin/modulizer.js:43:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
@jsilvermist --version doesn't work but the build process flew along without any error (node v8.11.1& polymer 1.7.1)
@davie-robertson Same issue for me regardless, this is running master, not 0.3.0 tag, otherwise exact same versions as you:
$ modulizer --out .
Error: Cannot find module '../lib/cli/index'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/node_modules/polymer-modulizer/bin/modulizer.js:43:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
So I uninstalled Node and NPM, installed it via NVM instead and it's working now using Node 9.11.1 and NPM 6.0.1.
@web-padawan I tried breaking it up into smaller subdirectories, and that resulted in https://github.com/Polymer/polymer-modulizer/issues/429
In addition, my Bower components are not in a folder called bower_components - that's overridden in .bowerrc - should that be picked up or is it trying to parse all of them too?
for windows SET NODE_OPTIONS "--max-old-space-size=8192" worked, javascript heap error was resolved. But still conversion did not happen as per #665
Anyone successful? Getting the same error.
And I don't get how I can increase the memory? If I run NODE_OPTIONS="--max_old_space_size=8192" from within "node", then quit node and run modulizer, is this enough?
EDIT: For windows use:
set NODE_OPTIONS=--max_old_space_size=8192 && node -v in the command line (try to make a variation with max_old_space_size or max-old-space-size)
Source: https://github.com/nodejs/node/issues/16999
It's running now but still with a lot of other errors. Will investigate later :)
@derhuebiii I gave up on this and wrote my own https://github.com/EvolutionJobs/HtmlImport2ESModule
It's much dumber than this is trying to be, it's basically a bunch of regexes, but it worked for me for this and #2811 (which was a deal breaker for me as we're continuing to maintain and develop after the conversion and the hidden <div> tags that this outputs are a mess).
setting node options doesn't help on linux.
others things I tried
npx --max_old_space_size=8000 modulizer --out .
node --max_old_space_size=8000 modulizer --out .
@derhuebiii I gave up on this and wrote my own https://github.com/EvolutionJobs/HtmlImport2ESModule
It's much dumber than this is trying to be, it's basically a bunch of regexes, but it worked for me for this and #2811 (which was a deal breaker for me as we're continuing to maintain and develop after the conversion and the hidden
<div>tags that this outputs are a mess).
Thanks all. I finally managed to convert the files (see EDIT in previous post), but I had to put all in one directory (no subdirectories). Also all references to Polymer components where removed. I did similar to you a search and a replace macro using my old <link rel="import" being replaced to import ...
The tool was not very smooth for me but all in all it looks I iwll get my project to work. Only missing polymerfire support, but that's offtopic :)
@jkanche try node --max-old-space-size=8000 modulizer --out .
@bicknellr will you have some time to look into this after the holidays?
Our users are experiencing issues with running relatively big projects (~ 200 HTML files) through polymer-modulizer. It's quite annoying to converting files one by one because of that.