relative / synchrony

javascript-obfuscator cleaner & deobfuscator
https://deobfuscate.relative.im/
GNU General Public License v3.0
840 stars 108 forks source link

Installation failures #56

Closed jhodgkinson-splunk closed 1 year ago

jhodgkinson-splunk commented 1 year ago

Running on an intel macbook (Ventura), following the steps in the readme results in nothing appearing in bin... and I tried pulling the latest release with no success either.

$ npm --version
9.6.2
$ node --version
v19.1.0

Reproduction steps:

cd $(mktemp -d)
wget https://github.com/relative/synchrony/archive/refs/tags/2.4.1.tar.gz
tar zxf 2.4.1.tar.gz
cd synchrony-2.4.1/
npm i
npm run build # fails

npm install output:

$ npm i

added 124 packages, and audited 125 packages in 9s

22 packages are looking for funding
  run `npm fund` for details

2 critical severity vulnerabilities

To address all issues, run:
  npm audit fix --force

Run `npm audit` for details.

Error output:

$ npm run build

> deobfuscator@2.4.1 build
> node scripts/build.js

Building lib ===

  dist/index.js  64.7kb

⚡ Done in 24ms
Copying CLI ===
Building type declarations ===
node_modules/@types/eslint-scope/index.d.ts:12:5 - error TS2416: Property 'scopes' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope[]'.
    Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope'.
      Types of property 'variables' are incompatible.
        Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable[]'.
          Property 'scope' is missing in type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable' but required in type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable'.

12     scopes: Scope[];
       ~~~~~~

  node_modules/@types/eslint/index.d.ts:88:9
    88         scope: Scope;
               ~~~~~
    'scope' is declared here.

node_modules/@types/eslint-scope/index.d.ts:13:5 - error TS2416: Property 'globalScope' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope'.

13     globalScope: Scope;
       ~~~~~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:14:5 - error TS2416: Property 'acquire' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type '(node: {}, inner?: boolean | undefined) => Scope | null' is not assignable to type '(node: Node, inner?: boolean | undefined) => Scope | null'.
    Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope | null' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope | null'.
      Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope'.

14     acquire(node: {}, inner?: boolean): Scope | null;
       ~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:15:5 - error TS2416: Property 'getDeclaredVariables' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type '(node: {}) => Variable[]' is not assignable to type '(node: Node) => Variable[]'.
    Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable[]'.

15     getDeclaredVariables(node: {}): Variable[];
       ~~~~~~~~~~~~~~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:21:5 - error TS2416: Property 'upper' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope | null' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope | null'.

21     upper: Scope | null;
       ~~~~~

node_modules/@types/eslint-scope/index.d.ts:22:5 - error TS2416: Property 'childScopes' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope[]'.

22     childScopes: Scope[];
       ~~~~~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:23:5 - error TS2416: Property 'variableScope' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope'.

23     variableScope: Scope;
       ~~~~~~~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:25:5 - error TS2416: Property 'variables' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable[]'.

25     variables: Variable[];
       ~~~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:26:5 - error TS2416: Property 'set' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'Map<string, import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable>' is not assignable to type 'Map<string, import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable>'.
    Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable'.

26     set: Map<string, Variable>;
       ~~~

node_modules/@types/eslint-scope/index.d.ts:27:5 - error TS2416: Property 'references' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Reference[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Reference[]'.
    Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Reference' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Reference'.
      Types of property 'from' are incompatible.
        Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope'.

27     references: Reference[];
       ~~~~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:28:5 - error TS2416: Property 'through' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Reference[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Reference[]'.

28     through: Reference[];
       ~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:35:5 - error TS2416: Property 'references' in type 'Variable' is not assignable to the same property in base type 'Variable'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Reference[]' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Reference[]'.

35     references: Reference[];
       ~~~~~~~~~~

node_modules/@types/eslint-scope/index.d.ts:41:5 - error TS2416: Property 'from' in type 'Reference' is not assignable to the same property in base type 'Reference'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Scope'.

41     from: Scope;
       ~~~~

node_modules/@types/eslint-scope/index.d.ts:42:5 - error TS2416: Property 'resolved' in type 'Reference' is not assignable to the same property in base type 'Reference'.
  Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable | null' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable | null'.
    Type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint-scope/index").Variable' is not assignable to type 'import("/private/var/folders/lk/zpzdr72d71d80vcgvz1mm4q80000gn/T/tmp.gmqbnFmu/synchrony-2.4.1/node_modules/@types/eslint/index").Scope.Variable'.

42     resolved: Variable | null;
       ~~~~~~~~

Found 14 errors.

tsc exited with code 2
relative commented 1 year ago

Hi, https://github.com/relative/synchrony/commit/b2cd9c8b8644347e457c1c10dae993609a4c0358 should have fixed the error creating type declarations.

results in nothing appearing in bin

The bin script (synchrony) should be copied from /src/cli.js to /dist/cli.js in the build script. The API should be output to /dist/index.js

jhodgkinson-splunk commented 1 year ago

I'm relatively new to NPM and javascript and trying to follow the directions in the README, are they correct or is there some other method I should be following to use this package?

$ npm install -g 'relative/synchrony#master' --verbose
npm verb cli /usr/local/Cellar/node/19.1.0/bin/node /usr/local/bin/npm
npm info using npm@9.6.2
npm info using node@v19.1.0
npm verb title npm install relative/synchrony#master
npm verb argv "install" "--global" "relative/synchrony#master" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/Users/jhodgkinson/.npm/_logs/2023-03-23T01_29_52_645Z-
npm verb logfile /Users/jhodgkinson/.npm/_logs/2023-03-23T01_29_52_645Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/prettier 1350ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/acorn 1358ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/eslint-scope 1358ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/acorn-walk 1360ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/yargs 1360ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/acorn-loose 1382ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@javascript-obfuscator%2fescodegen 1434ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/mersenne-twister 1609ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/require-directory 916ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/escalade 918ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/esrecurse 921ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/estraverse 921ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/cliui 921ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/optionator 927ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/string-width 924ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/source-map 1441ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/esprima 1446ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/yargs-parser 1440ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/esutils 1448ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/get-caller-file 1444ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/y18n 1444ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@javascript-obfuscator%2festraverse 1452ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/fast-levenshtein 329ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/deep-is 335ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/word-wrap 335ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/prelude-ls 337ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/levn 334ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/type-check 337ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-fullwidth-code-point 479ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/strip-ansi 487ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/strip-ansi 480ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/emoji-regex 486ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/wrap-ansi 490ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/ansi-regex 260ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/ansi-styles 509ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/color-convert 271ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/color-name 468ms (cache revalidated)
npm http fetch GET 200 https://codeload.github.com/relative/synchrony/tar.gz/b2cd9c8b8644347e457c1c10dae993609a4c0358 1326ms (cache revalidated)

added 37 packages in 17s

2 packages are looking for funding
  run `npm fund` for details
npm verb exit 0
npm info ok

2023-03-23T01_30_09_565Z-debug-0.log

relative commented 1 year ago

I don't think installing from git will build the module, so I should probably remove that from the readme. I believe npm config get prefix should show you where global modules installed with bin entries get placed.

You should be able to

git clone https://github.com/relative/synchrony.git synchrony
cd synchrony
npm install
npm run build
npm link # Links package to global node_modules folder

Then after synchrony should be available in your PATH

jhodgkinson-splunk commented 1 year ago

Thanks, perfect!