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

Error "SyntaxError: Unexpected token function" #31

Closed
gorgeorg opened this issue Jan 23, 2018 · 12 comments
Closed

Error "SyntaxError: Unexpected token function" #31

gorgeorg opened this issue Jan 23, 2018 · 12 comments

Comments

@gorgeorg
Copy link

Description

There is error when run daggraph in Android project folder.

Steps to reproduce

E:<path_of_android_project>>daggraph
C:\Users<DELETED>\AppData\Roaming\npm\node_modules\daggraph\src\dagger\DaggerAnalyzer.js:13
async function findComponents(projectRootPath){
^^^^^^^^
SyntaxError: Unexpected token function
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Users<DELETED>\AppData\Roaming\npm\node_modules\daggraph\src\router.js:7:25)
at Module._compile (module.js:570:32)

Expected behaviour

Created dependency graph

Screenshot

@mozarty
Copy link

mozarty commented Jan 24, 2018

same here

@dvdciri
Copy link
Owner

dvdciri commented Jan 25, 2018

Thanks for reporting that, do you have a sample project on github that I can test and reproduce this?

@dvdciri
Copy link
Owner

dvdciri commented Jan 25, 2018

Can you also try to upgrade node to the latest version and check the version that you have. Some versions does not support the async function

@gorgeorg
Copy link
Author

Hi. I have updated node to v8.9.4.
The result is:
E:<path_project>>daggraph
Analyzing dagger components and modules..
TypeError: pending.then is not a function
at FileHound._searchAsync (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\filehound\lib\filehound.js:705:22)
at tryCatcher (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\util.js:16:23)
at MappingPromiseArray._promiseFulfilled (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\map.js:61:38)
at MappingPromiseArray.PromiseArray._iterate (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\promise_array.js:114:31)
at MappingPromiseArray.init (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\promise_array.js:78:10)
at MappingPromiseArray._asyncInit (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\map.js:30:10)
at Async._drainQueue (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\async.js:138:12)
at Async._drainQueues (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues (C:\Users\Name\AppData\Roaming\npm\node_modules\daggraph\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)

@dvdciri
Copy link
Owner

dvdciri commented Jan 25, 2018

What version of Daggraph are you using? Try updating the latest one..

@gorgeorg
Copy link
Author

gorgeorg commented Jan 25, 2018

"version": "0.2.5", from package.json.
Also I have downloaded https://github.com/dvdciri/MVP-Clean-Sample-Android.
Result the same as I mentioned above.

@mibrahimdev
Copy link

mibrahimdev commented Jan 29, 2018

same error with me too

`
/usr/lib/node_modules/daggraph/src/dagger/DaggerAnalyzer.js:13
async function findComponents(projectRootPath){
^^^^^^^^
SyntaxError: Unexpected token function
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/lib/node_modules/daggraph/src/router.js:7:25)
at Module._compile (module.js:541:32)

`

Edit: after updating npm the works fine now.

@iamBedant
Copy link

Getting the same error after updating to V0.2.5. Before updating It was working as expected

@dvdciri
Copy link
Owner

dvdciri commented Feb 15, 2018

@gorgeorg The project you mentioned doesn't use dagger and i'm correctly getting this:

➜  MVP-Clean-Sample git:(master) ✗ daggraph
Analyzing dagger components and modules..
Couldn't find any components, are you sure this project is using Dagger?

Is someone else is still having this issue, try to update npm to the latest version as mentioned by @MohamedISoliman. Please let me know if you manage to fix this, so i can close.

@gorgeorg
Copy link
Author

Sorry my fault about MVP-Clean-Sample.
Could you try on https://github.com/mgrzechocinski/dagger2-example?

@dvdciri
Copy link
Owner

dvdciri commented Feb 17, 2018

@gorgeorg The only issue i'm having with that repo is that the build folder does not exists, so when it asks me to generate a the chart i want, it fails. Will fix that very soon.

If i create manually the folder the chart is generated succesfully.
Node: v9.2.1
Npm: 5.5.1
Daggraph: 0.2.5

The bug has been fixed here #35

@dvdciri
Copy link
Owner

dvdciri commented Feb 23, 2018

Closing due to lack of activity.

@dvdciri dvdciri closed this as completed Feb 23, 2018
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

5 participants