Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cerebro installation fails with unexpected token operator #356

Closed
2 tasks done
IgnusG opened this issue Jul 2, 2017 · 18 comments
Closed
2 tasks done

Cerebro installation fails with unexpected token operator #356

IgnusG opened this issue Jul 2, 2017 · 18 comments

Comments

@IgnusG
Copy link

IgnusG commented Jul 2, 2017

  • I am on the latest Cerebro.app version
  • I have searched the issues of this repo and believe that this is not a duplicate
  • OS version and name: Arch
  • Cerebro version: 0.3.0-1 (cerebro) & 0.2.7.r4.ga69a0a8-1 (cerebro-git)

Issue

Installing via AUR results in following error message with both cerebro and cerebro-git package:

Parse error at ./app/dist/main.bundle.js:940,5060                                         
,h,k){'use strict';var m=k(9);const n=u=>u.replace(/[^а-яa-z0-9\s]/i,'').replace          
                                        ^    
SyntaxError: Unexpected token: operator (>)  
    at JS_Parse_Error.get (eval at <anonymous> (/home/jonathan/.cache/pacaur/cerebro/src/cerebro-0.3.0/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:86:23)               
    at /home/jonathan/.cache/pacaur/cerebro/src/cerebro-0.3.0/node_modules/uglify-js/bin/uglifyjs:384:39        
    at time_it (/home/jonathan/.cache/pacaur/cerebro/src/cerebro-0.3.0/node_modules/uglify-js/bin/uglifyjs:620:15)                     
    at /home/jonathan/.cache/pacaur/cerebro/src/cerebro-0.3.0/node_modules/uglify-js/bin/uglifyjs:345:9         
    at tryToString (fs.js:512:3)             
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:500:12)
@maximbaz
Copy link
Contributor

maximbaz commented Jul 2, 2017

To clarify whether the issue with AUR package or application itself, could you please confirm if the issue happens during installation, or after installation when starting the app?

@IgnusG
Copy link
Author

IgnusG commented Jul 2, 2017

@maximbaz during installation

@IgnusG
Copy link
Author

IgnusG commented Jul 2, 2017

I just tried AppImage which seems to be working except some searches result in a transparent box with nothing in it. Is this a known bug?

Bugy

@maximbaz
Copy link
Contributor

maximbaz commented Jul 2, 2017

I confirm, the error happens to me too during installation. Interestingly though I installed cerebro just two days ago from the same AUR package and it was successful. It is also curious that both cerebro and cerebro-git are affected - cerebro follows official releases and it was not updated for quite some time already.

@KELiON Looks like some dependency got updated (uglifyjs?) which breaks the build now.

As for the transparent window bug, it is tracked in #285

@KELiON
Copy link
Collaborator

KELiON commented Jul 3, 2017

@maximbaz 🤔 even if something was updated it should work, because all dependencies are locked in yarn.lock. I've just tried to do rm -rf ./node_modules && yarn && yarn build and it works for me. Can you try to run it on your machine?

@maximbaz
Copy link
Contributor

maximbaz commented Jul 3, 2017

That is almost exactly what AUR package is doing, but for the sake of experiment I've just cloned the repo from scratch and ran the following:

$ git clone https://github.com/KELiON/cerebro.git
$ cd cerebro
$ yarn
$ cd app
$ yarn
$ cd ..
$ yarn run build

And it reproduces, exactly the same error.

@maximbaz
Copy link
Contributor

maximbaz commented Jul 3, 2017

If you have docker, I've recently made a docker image that builds AUR packages, you can try it 🙂
It reproduces the issue as well.

$ docker pull maximbaz/arch-build-aur
$ docker run --rm -v $(pwd):/pkg maximbaz/arch-build-aur /bin/bash -c '/build.sh cerebro'

Put cerebro for the latest release or cerebro-git to fetch latest master.

@IgnusG
Copy link
Author

IgnusG commented Jul 3, 2017

@KELiON I've tried @maximbaz's docker and your command to build locally. Same error 🙁

@IgnusG IgnusG changed the title Cerebro installation from AUR fails with unexpected token error Cerebro installation fails with unexpected token operator Jul 8, 2017
@IgnusG
Copy link
Author

IgnusG commented Jul 8, 2017

@KELiON Your builds are failing as well https://travis-ci.org/KELiON/cerebro/builds/250264889

@KELiON
Copy link
Collaborator

KELiON commented Jul 10, 2017

@IgnusG yep, started to fail on travis after merging last PR, I didn't find time to fix, I'll try to do it asap

@enguerran
Copy link

It seems that uglify-js does not accept arrow function syntax. I did not push the analyze further. I am an Arch user who just discovered cerebro and would like to pacaur -S cerebro to try it out.

@KELiON
Copy link
Collaborator

KELiON commented Jul 11, 2017

@enguerran uglify-js doesn't work with new ES syntax, i.e. with arrow functions. But in cerebro we're using uglify-es, that do support it

@KELiON
Copy link
Collaborator

KELiON commented Jul 11, 2017

Tried to clone repo and reinstall everything from scratch, but still works. Can someone run ./node_modules/.bin/uglifyjs --version? It should be uglify-es 3.0.15. And run uglify from specified directory node_modules/.bin, like this:

yarn run build-main 
yarn run build-renderer
./node_modules/.bin/uglifyjs ./app/dist/main.bundle.js -o ./app/dist/main.bundle.js --mangle
./node_modules/.bin/uglifyjs ./app/dist/background.bundle.js -o ./app/dist/background.bundle.js --mangle

/cc @maximbaz

@maximbaz
Copy link
Contributor

This seems to be the problem. Clean run, once again.

❯  git clone https://github.com/KELiON/cerebro.git
Cloning into 'cerebro'...
remote: Counting objects: 5827, done.
remote: Total 5827 (delta 0), reused 0 (delta 0), pack-reused 5827
Receiving objects: 100% (5827/5827), 3.31 MiB | 1.69 MiB/s, done.
Resolving deltas: 100% (3604/3604), done.

❯  cd cerebro && yarn && cd ./app && yarn && cd ../
yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
warning 7zip-bin-mac@1.0.1: The platform "linux" is incompatible with this module.
info "7zip-bin-mac@1.0.1" is an optional dependency and failed compatibility check. Excluding it from installation.
warning 7zip-bin-win@2.0.2: The platform "linux" is incompatible with this module.
info "7zip-bin-win@2.0.2" is an optional dependency and failed compatibility check. Excluding it from installation.
warning fsevents@1.1.1: The platform "linux" is incompatible with this module.
info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "eslint-config-airbnb@9.0.1" has incorrect peer dependency "eslint@^2.9.0".
warning "eslint-config-airbnb@9.0.1" has incorrect peer dependency "eslint-plugin-import@^1.7.0".
warning "eslint-config-airbnb-base@3.0.1" has incorrect peer dependency "eslint@^2.9.0".
warning "eslint-config-airbnb-base@3.0.1" has incorrect peer dependency "eslint-plugin-import@^1.7.0".
[4/4] Building fresh packages...
$ concurrently "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json"
[0] node node_modules/fbjs-scripts/node/check-dev-engines.js package.json exited with code 0
Done in 6.76s.
yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.1.1: The platform "linux" is incompatible with this module.
info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 6.40s.

❯  ./node_modules/.bin/uglifyjs --version
uglify-js 2.8.27

@IgnusG
Copy link
Author

IgnusG commented Jul 11, 2017

@KELiON I can confirm the latest release of cerebro uses uglify-js 2.6.4 and HEAD uglify-js 2.8.27. But uglify-es has the correct 3.0.15 version.

$ npm list | grep uglify
uglify-es@3.0.15
│ ├─┬ uglify-js@2.8.27
│ │ ├── uglify-to-browserify@1.0.
$ yarn list | grep uglify
uglify-es@3.0.15
├─ uglify-js@2.8.27
│  ├─ uglify-to-browserify@~1.0.0
├─ uglify-to-browserify@1.0.2
│  ├─ uglify-js@^2.8.

@maximbaz
Copy link
Contributor

It's fascinating, I mean we packed the release sources in an archive, locked dependencies versions, I'm 100% positive it used to work just two weeks ago on my own laptop with the same OS, and now the same archive cannot correctly be installed, and the issue reproduces every single time... I'm very keen to see the solution for this bug, what else has to be locked to ensure that a given sources archive will always be able to build successfully in the future.

@KELiON
Copy link
Collaborator

KELiON commented Jul 11, 2017

As a temporary solution I fixed path to uglify binary (./node_modules/uglify-es/bin/uglifyjs, instead of ./node_modules/.bin/uglifyjs). I'll try to investigate more why it happens, but #362 should fix installation issue

@maximbaz
Copy link
Contributor

That works 👍

To state the obvious, once its merged, cerebro-git AUR package will work, but cerebro will still not work until a new version is released that includes this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants