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

Build failure - \node-v6.7.0-win-x64\node.exe'' finished with non-zero exit value 1 #608

Closed
ImGokulM opened this issue Aug 3, 2017 · 27 comments

Comments

@ImGokulM
Copy link

ImGokulM commented Aug 3, 2017

I have installed Node Js version v6.11.0. But I'm getting the following error. Please help me on this.

Information:Gradle tasks [:apollo-android-support:generateDebugSources, :apollo-android-support:mockableAndroidJar, :apollo-android-support:prepareDebugUnitTestDependencies, :apollo-android-support:generateDebugAndroidTestSources, :apollo-espresso-support:generateDebugSources, :apollo-espresso-support:generateDebugAndroidTestSources, :apollo-espresso-support:mockableAndroidJar, :apollo-espresso-support:prepareDebugUnitTestDependencies, :apollo-integration:generateDebugSources, :apollo-integration:mockableAndroidJar, :apollo-integration:prepareDebugUnitTestDependencies, :apollo-integration:generateDebugAndroidTestSources, :apollo-sample:generateDebugSources, :apollo-sample:mockableAndroidJar, :apollo-sample:prepareDebugUnitTestDependencies, :apollo-sample:generateDebugAndroidTestSources]
Error:Execution failed for task ':apollo-integration:generateDebugApolloIR'.

Process 'command '\apollo-android-master\apollo-integration.gradle\nodejs\node-v6.7.0-win-x64\node.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 3.551 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

@MattiSchnurbusch
Copy link

MattiSchnurbusch commented Aug 4, 2017

I'm having the exact same issue tried around with different node versions and tried different order of gradle tasks also. Happens to me on 'com.apollographql.apollo:gradle-plugin:0.4.0' and on 'com.apollographql.apollo:gradle-plugin:0.4.1-SNAPSHOT'. Any Idea how this could be solved?

@marwanad
Copy link
Contributor

marwanad commented Aug 4, 2017

Can you try running with --info --stacktrace and post the output?

@YkSix
Copy link

YkSix commented Aug 6, 2017

Apollo does not support anonymous operations
apollographql/apollo-tooling#184

Successfully started process 'command '/Users/xxx/Documents/FirstGraphQL/app/.gradle/nodejs/node-v6.7.0-darwin-x64/bin/node''
.../graphql/zzz/firstgraphql/GithuntFeedQuery.graphql: Apollo does not support anonymous operations
error: Validation of GraphQL query document failed
:app:generateDebugApolloIR FAILED
:app:generateDebugApolloIR (Thread[Daemon worker,5,main]) completed. Took 0.579 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateDebugApolloIR'.
> Process 'command '/Users/xxx/Documents/FirstGraphQL/app/.gradle/nodejs/node-v6.7.0-darwin-x64/bin/node'' finished with non-zero exit value 1

@digitalbuddha
Copy link
Contributor

You need to name your query like so https://github.com/apollographql/apollo-android/blob/master/apollo-sample/src/main/graphql/com/apollographql/apollo/sample/GithuntFeedQuery.graphql#L1

@Pkmmte
Copy link

Pkmmte commented Oct 10, 2017

I had this issue with Apollo 0.4.1 and Kotlin 1.1.51 and the only thing that worked was downgrading Kotlin to 1.1.50.

@singhalmanav
Copy link

I'm also getting the same error. I double checked the schema.json and .graphql query file.

Error:org.gradle.process.internal.ExecException: Process 'command
'......app/.gradle/nodejs/node-v6.7.0-darwin-x64/bin/node'' finished with non-zero exit value 1

I'm using apollo v0.4.4 and kotlin v1.2.20. Can anyone tell me why Apollo is throwing this error during code generation?

@vincenthauser
Copy link

Ok, I have the exact same problem but I could build in command line but not through Android Studio. Running with --info in AS's terminal I got this:

npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\vince\dev\app\build\apollo-codegen\node_modules\apollo-codegen' -> 'C:\Users\vince\dev\app\build\apollo-codegen\node_modules\.apollo-codegen.DELETE'
npm ERR!     at Error (native) parent: 'apollo-android' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

So for me it seems to be a permissions problem

@singhalmanav
Copy link

I'm getting this error with Apollo v0.4.4 but the code-gen works fine with v0.4.3.

Error:org.gradle.process.internal.ExecException: Process 'command
'......app/.gradle/nodejs/node-v6.7.0-darwin-x64/bin/node'' finished with non-zero exit value 1

@wax911
Copy link

wax911 commented Mar 2, 2018

Apollo 0.4.4
Ubuntu 17.10

Error:Execution failed for task ':app:installApolloCodegen'. Process 'command './app/.gradle/nodejs/node-v6.7.0-linux-x64/bin/node'' finished with non-zero exit value 243

Same issue here as well, even with the sample project, only difference is instead of getting exit value of 1 I get exit value of 243

Update!! Exit Value 243 Solved

So after checking the log file for:

./app/.gradle/nodejs/node-v6.7.0-linux-x64/bin/node

I saw that the error I was getting was due to the .npm directory in my home folder belonging to root and not my current user which meant I wouldn't be able to run any npm commands without using sudo.

Solution (Exit Value 243):
Change ownership of you .npm folder so that the current user doesn't have to run npm commands as sudo/root

sudo chown -R $(whoami) ~/.npm

Credits: https://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo

Exit Value 1 (Error:Validation of GraphQL query document failed)

My specific issue for:

Error:Execution failed for task ':app:generateDebugApolloIR'. Process 'command ./app/.gradle/nodejs/node-v6.7.0-linux-x64/bin/node'' finished with non-zero exit value 1

Appears to be caused by using similar fragment names in my separate .graphql files, thus changing the name to assure they are different fixed my issue

@jcammmmm
Copy link

Pay attention that every query has a name...

@hatched-nari
Copy link

I had the same issue, and was able to resolve it by naming my query as mentioned above.

@hshahdoost
Copy link

hshahdoost commented Aug 11, 2018

I ran into the same problem today after trying to update my schema.json, and double checked my new queries. There is nothing wrong with them. Could there be another reason for this problem?

New information
After comparing the new schema.json with the old one, I noticed that the format of the generated schema has changed in the new apollo-cli, and it has resulted in this error.
The old format was like this

{
  "data": {
    "__schema": {
      "queryType": {
        "name": "Query"
      },
      "mutationType": {
        "name": "Mutation"
      },
      "subscriptionType": null,
      ....

While the new format is like this

{
  "queryType": {
    "name": "Query"
  },
  "mutationType": {
    "name": "Mutation"
  },
  "subscriptionType": null,

The problem was solved by using the old version of appollo-codegen cli.

@hopstad
Copy link

hopstad commented Aug 24, 2018

@hshahdoost
Same here man. A variable was changed on the graphql server and I needed to update my query. Therefor also needed to update the schema.json and the shitshow started.

How did you downgrade the apollo-codegen cli ?

@hshahdoost
Copy link

hshahdoost commented Aug 25, 2018

@hopstad first make sure you are not using the apollo cli (the old apollo-codegen has been deprecated and been replaced by this new command). the generated schema by apollo cli is not readable by apollo android
Then go to this url to see the available versions of apollo-codegen.

And finally uninstall your current apollo-codegen and install it in the following format

npm install apollo-codegen@0.17.0-alpha.1

PS: by the time I faced this error, Apollo android could not read the schema generated by apollo cli , It might not be like this in the future versions so the best practice would be to first update your library to the latest version and then (if it could not read the schema) try using apollo-codegen command

@hopstad
Copy link

hopstad commented Aug 27, 2018

@hshahdoost
Thanks mate! You saved my brain from exploding.

Solved by removing apollo and installing the new one. Then using new command for downloading schema : apollo schema:download --endpoint=https://something.com

@hopstad
Copy link

hopstad commented Aug 27, 2018

@hshahdoost

Nevermind.. Still not working. I thought it was, but was wrong. What I did was uninstall apollo and tried the new one (apollo schema:download). The error was now of a different type and said the following:

GraphQL schema file should contain a valid GraphQL introspection query result

Tried to uninstall again and download a old apollo version (0.20.2) and did the same old "apollo-codegen" and them I'm back to the same error as before:

error: Validation of GraphQL query document failed

EDIT
Finally fixed. Totally removed everything. npm, apollo etc. Deleted .grade file in Android Studio. Reinstalled everything (apollo-codegen not apollo) and it works now.

@hshahdoost
Copy link

@hopstad I kind of got surprised because in your mention above, you were using apollo instead of apollo-codegen

Solved by removing apollo and installing the new one. Then using new command for downloading schema : apollo schema:download --endpoint=https://something.com

@kpjofficial
Copy link

I am facing this error using AWS-Amplify. apollo is part of Amplify now. I am facing the error like

error: Validation of GraphQL query document failed

@kpjofficial
Copy link

@hshahdoost

EDIT
Finally fixed. Totally removed everything. npm, apollo etc. Deleted .grade file in Android Studio. Reinstalled everything (apollo-codegen not apollo) and it works now.

.grade file?

@hshahdoost
Copy link

hshahdoost commented Jan 5, 2019

@kpjofficial no, There is nothing wrong with the .gradle file the apollo nodejs command is incompatible with the new apollo android. All you have to do is to the use the old apollo-codegen instead. here is a list of available versions install the old version and use it to generate your schema file.

@kpjofficial
Copy link

I am using it as part of AWS Amplify, and it does not require separate apollo installation. For me, this error was due to bad query nomenclature in AppSync. Amplify automatically generates all the files in android based on the graphql queries and there was issue in it. I solved it by using new graphql schema with proper naming conventions, so that the files generated in Android does not throw this error.

Do not use any special characters in the graphql in AppSync, apollo (here, Amplify) messes it up.

@Nieltz
Copy link

Nieltz commented Jan 7, 2019

Hey @kpjofficial, I am facing the same issue, which naming conventions have you used to fix it?

@kpjofficial
Copy link

@Nieltz By naming conventions, I meant to avoid usage of special characters and naming in camelcase but then you can also check
https://facebook.github.io/graphql/June2018/#sec-Appendix-Notation-Conventions

@adrian1388
Copy link

@kpjofficial no, There is nothing wrong with the .gradle file the apollo nodejs command is incompatible with the new apollo android. All you have to do is to the use the old apollo-codegen instead. here is a list of available versions install the old version and use it to generate your schema file.

I recently tried apollo-codegen, after receiving the incompatibility of apollo result:
apollo-codegen download-schema http://localhost:8080/graphql/
but actually, the error says nothing:
error: Errors in introspection query result:
...

apollo-codegen --version
0.20.2

I'm stuck here.

@jazart
Copy link

jazart commented Feb 6, 2019

Also having the same issue. I installed apollo-codegen to create the schema.json but I'm still getting a build failure with exit code 1.

@adrian1388
Copy link

Fixed for me:

The schema generated by
apollo schema:download --endpoint=http://localhost:8080/graphql
or
apollo service:download --endpoint=http://localhost:8080/graphql

results without the "data" name.

Adding

{
  "data": {
    "__schema": {...}
  }
}

with the corresponding spaces, finished the ':generateMainApolloIR' subtask, generating the classes for the queries on *.graphql files successfully.

@RachitKalra
Copy link

Fixed for me:

The schema generated by
apollo schema:download --endpoint=http://localhost:8080/graphql
or
apollo service:download --endpoint=http://localhost:8080/graphql

results without the "data" name.

Adding

{
  "data": {
    "__schema": {...}
  }
}

with the corresponding spaces, finished the ':generateMainApolloIR' subtask, generating the classes for the queries on *.graphql files successfully.

Been stuck on this , still not working , can you just walk me through what steps you took ,

Apollo gradle plugin version etc.

:(

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

No branches or pull requests