LiteMol icon indicating copy to clipboard operation
LiteMol copied to clipboard

errors when building with gulp

Open blackjack-uic opened this issue 3 years ago • 3 comments

Hi, I encountered an error when trying to build with gulp. I ran the first two npm commands and it worked fine. The error look like this:

PS C:\tools\LiteMol-2> gulp
[20:45:52] Requiring external module ts-node/register
{ TSError: ⨯ Unable to compile TypeScript
gulpfile.ts (163,46): Argument of type '"UTF-8"' is not assignable to parameter of type '"ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "...'. (2345)
gulpfile.ts (164,59): Argument of type '"UTF-8"' is not assignable to parameter of type '"ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "...'. (2345)
gulpfile.ts (166,69): Argument of type '{ encoding: "UTF-8"; }' is not assignable to parameter of type 'WriteFileOptions'.
  Type '{ encoding: "UTF-8"; }' is not assignable to type 'ObjectEncodingOptions & Abortable & { mode?: string | number; flag?: string; }'.
    Type '{ encoding: "UTF-8"; }' is not assignable to type 'ObjectEncodingOptions'.
      Types of property 'encoding' are incompatible.
        Type '"UTF-8"' is not assignable to type 'BufferEncoding'. (2345)
gulpfile.ts (168,47): Argument of type '"UTF-8"' is not assignable to parameter of type '"ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "...'. (2345)
gulpfile.ts (172,43): Argument of type '{ encoding: "UTF-8"; }' is not assignable to parameter of type 'WriteFileOptions'.
  Type '{ encoding: "UTF-8"; }' is not assignable to type 'ObjectEncodingOptions & Abortable & { mode?: string | number; flag?: string; }'.
    Type '{ encoding: "UTF-8"; }' is not assignable to type 'ObjectEncodingOptions'.
      Types of property 'encoding' are incompatible.
        Type '"UTF-8"' is not assignable to type 'BufferEncoding'. (2345)
    at getOutput (C:\tools\LiteMol-2\node_modules\ts-node\src\index.ts:307:15)
    at C:\tools\LiteMol-2\node_modules\ts-node\src\index.ts:336:16
    at Object.compile (C:\tools\LiteMol-2\node_modules\ts-node\src\index.ts:496:11)
    at Module.m._compile (C:\tools\LiteMol-2\node_modules\ts-node\src\index.ts:392:43)
    at Module._extensions..js (module.js:664:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\tools\LiteMol-2\node_modules\ts-node\src\index.ts:395:12)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
  diagnostics:
   [ { message: 'gulpfile.ts (163,46): Argument of type \'"UTF-8"\' is not assignable to parameter of type \'"ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "...\'. (2345)',
       code: 2345 },
     { message: 'gulpfile.ts (164,59): Argument of type \'"UTF-8"\' is not assignable to parameter of type \'"ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "...\'. (2345)',
       code: 2345 },
     { message: 'gulpfile.ts (166,69): Argument of type \'{ encoding: "UTF-8"; }\' is not assignable to parameter of type \'WriteFileOptions\'.\n  Type \'{ encoding: "UTF-8"; }\' is not assignable to type \'ObjectEncodingOptions & Abortable & { mode?: string | number; flag?: string; }\'.\n    Type \'{ encoding: "UTF-8"; }\' is not assignable to type \'ObjectEncodingOptions\'.\n      Types of property \'encoding\' are incompatible.\n        Type \'"UTF-8"\' is not assignable to type \'BufferEncoding\'. (2345)',
       code: 2345 },
     { message: 'gulpfile.ts (168,47): Argument of type \'"UTF-8"\' is not assignable to parameter of type \'"ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "...\'. (2345)',
       code: 2345 },
     { message: 'gulpfile.ts (172,43): Argument of type \'{ encoding: "UTF-8"; }\' is not assignable to parameter of type \'WriteFileOptions\'.\n  Type \'{ encoding: "UTF-8"; }\' is not assignable to type \'ObjectEncodingOptions & Abortable & { mode?: string | number; flag?: string; }\'.\n    Type \'{ encoding: "UTF-8"; }\' is not assignable to type \'ObjectEncodingOptions\'.\n      Types of property \'encoding\' are incompatible.\n        Type \'"UTF-8"\' is not assignable to type \'BufferEncoding\'. (2345)',
       code: 2345 } ] }

It looks like there is an encoding problem? I would much appreciate if anyone could help!

blackjack-uic avatar Jan 07 '22 02:01 blackjack-uic

Hi, this will likely be caused by NodeJS version. Would using https://molstar.org be an option for you?

dsehnal avatar Jan 07 '22 09:01 dsehnal

OK, that would be an option. I'll look into it, thx! Would integrating molstar be similar as litemol?

blackjack6666 avatar Jan 09 '22 03:01 blackjack6666

Yes, it's quite similar.

dsehnal avatar Jan 09 '22 15:01 dsehnal