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

"Caused by: org.gradle.api.GradleException: Apollo-codegen was not found in node_modules. Please run the installApolloCodegen task." only on build server #1265

Closed
tir38 opened this issue Apr 24, 2019 · 13 comments

Comments

@tir38
Copy link

tir38 commented Apr 24, 2019

We are seeing this on our build server (Bitrise)


> Task :api:preBuild UP-TO-DATE
> Task :api:preDebugBuild UP-TO-DATE
> Task :api:compileDebugAidl NO-SOURCE
> Task :api:compileDebugRenderscript NO-SOURCE
> Task :api:nodeSetup UP-TO-DATE
> Task :api:installApolloCodegen UP-TO-DATE
> Task :api:generateDebugApolloIR FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':api:generateDebugApolloIR'.
> Apollo-codegen was not found in node_modules. Please run the installApolloCodegen task.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':api:generateDebugApolloIR'.
...
Caused by: org.gradle.api.GradleException: Apollo-codegen was not found in node_modules. Please run the installApolloCodegen task.

This is only happening on our build server (Bitrise). This is still happening after I explicitly call
/gradlew installApolloCodegen before trying to build our app.

After adding the explicit install step I see this log as part of the install step (same as #1042)

> Task :api:nodeSetup
> Task :api:installApolloCodegen
npm WARN deprecated apollo-codegen@0.19.1: The 'apollo-codegen' command has been replaced with the more-powerful 'apollo' CLI. Switch to 'apollo' to ensure future updates and visit https://npm.im/apollo#code-generation for more information.

I'm not sure if this last part is relevant.

I also tested by installing node package directly thx to #1043 (comment) and I'm still seeing the same problem

@sav007
Copy link
Contributor

sav007 commented Apr 25, 2019

Is it possible to get full logs of build with --stacktrace option?

@jbttn
Copy link
Contributor

jbttn commented Apr 26, 2019

We're running into this as well. Started happening out of the blue with no changes to the build server that I know of. Here's a stack trace:

> Task :webservices:preReleaseUnitTestBuild UP-TO-DATE
> Task :webservices:generateReleaseUnitTestResValues
> Task :webservices:generateReleaseUnitTestResources
> Task :webservices:mergeReleaseUnitTestResources
> Task :webservices:processReleaseUnitTestManifest
> Task :webservices:processReleaseUnitTestResources
> Task :webservices:generateReleaseUnitTestSources UP-TO-DATE
> Task :webservices:mergeReleaseAssets
> Task :webservices:generateReleaseUnitTestAssets UP-TO-DATE
> Task :webservices:mergeReleaseUnitTestAssets
> Task :webservices:packageReleaseUnitTestForUnitTest
> Task :webservices:generateReleaseUnitTestConfig
> Task :webservices:processReleaseUnitTestJavaRes

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':webservices:generateReleaseApolloIR'.
> Apollo-codegen was not found in node_modules. Please run the installApolloCodegen task.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':webservices:generateReleaseApolloIR'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:95)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:119)
	at org.gradle.api.internal.tasks.execution.ResolvePreviousStateExecuter.execute(ResolvePreviousStateExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:94)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: Apollo-codegen was not found in node_modules. Please run the installApolloCodegen task.
	at com.apollographql.apollo.gradle.ApolloLocalCodegenGenerationTask.exec(ApolloLocalCodegenGenerationTask.groovy:26)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:704)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:671)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:284)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:273)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:258)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:145)
	at org.gradle.internal.execution.impl.steps.ExecuteStep.execute(ExecuteStep.java:49)
	at org.gradle.internal.execution.impl.steps.CancelExecutionStep.execute(CancelExecutionStep.java:34)
	at org.gradle.internal.execution.impl.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:69)
	at org.gradle.internal.execution.impl.steps.TimeoutStep.execute(TimeoutStep.java:49)
	at org.gradle.internal.execution.impl.steps.CatchExceptionStep.execute(CatchExceptionStep.java:33)
	at org.gradle.internal.execution.impl.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)
	at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:43)
	at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:29)
	at org.gradle.internal.execution.impl.steps.CacheStep.executeWithoutCache(CacheStep.java:134)
	at org.gradle.internal.execution.impl.steps.CacheStep.lambda$execute$3(CacheStep.java:83)
	at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:82)
	at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:36)
	at org.gradle.internal.execution.impl.steps.PrepareCachingStep.execute(PrepareCachingStep.java:33)
	at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:38)
	at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:23)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:34)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:91)
	... 32 more


* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 17s
154 actionable tasks: 148 executed, 6 up-to-date

@sav007
Copy link
Contributor

sav007 commented Apr 27, 2019

My only assumption is that it get installed into different location than getProject().getBuildDir()/apollo-codegen/node_modules/apollo-codegen/

Does this issue happen only on CI but locally runs fine?
Is there any way to verify that /build/apollo-codegen/node_modules/apollo-codegen/ contains the installed apollo-codegen npm?

@emanzanoaxa
Copy link

Same here, local build runs ok but fails with the same error on C.I (CircleCI).
Also checked the contents of {module}/build/apollo-codegen/node_modules/apollo-codegen/ and seems to contain the installed apollo-codegen.

@sav007
Copy link
Contributor

sav007 commented May 1, 2019

@emanzanoaxa is this file exist on CI apollo-codegen/node_modules/apollo-codegen/lib/cli.js?

@sav007
Copy link
Contributor

sav007 commented May 1, 2019

The strange part is that if it started out of the blue, means something on infrastructure side changed .

@emanzanoaxa
Copy link

Yes, it exists.
It makes no sense that is working locally and not on C.I, it must have something to do with the C.I system but I don't have any clue about what can be happening. Also seems that installApolloCodegen gradle task is running ok on C.I

@heitorcolangelo
Copy link

I'm facing the same problem but locally

@sav007
Copy link
Contributor

sav007 commented May 16, 2019

Please give it a try with the latest release 1.0.0

@bishopmatthew
Copy link

I think I'm seeing the same (or similar) issue on CI on 1.0.1

> Task :profile:generateReleaseApolloIR FAILED
module.js:457
    throw err;
    ^
Error: Cannot find module '/bitrise/src/profile/build/apollo-codegen/node_modules/apollo-codegen/lib/cli.js'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':profile:generateReleaseApolloIR'.
> Process 'command '/bitrise/src/profile/.gradle/nodejs/node-v6.7.0-linux-x64/bin/node'' finished with non-zero exit value 1

But when I run the build while attached to the machine I see that the /bitrise/src/profile/build/apollo-codegen/node_modules/apollo-codegen/lib/cli.js file does exist. Any ideas? It's been hard to reproduce locally, though it does happen sometimes on some machines.

@hbb20
Copy link

hbb20 commented Jul 23, 2019

I work with @bishopmatthew and we were trying few things to solve this. In logs, we noticed label "UP-TO-DATE" with installApolloCodegen (which it should not be) and skipped. So we added --rerun-tasks option to the build step and seems like it's working. So it might be a problem with logic that decides if task is UP-TO-DATE.

We also use Bitrise as @tir38.

@ghadly
Copy link

ghadly commented Aug 16, 2019

I am facing the same problem with Bitrise 🤔, using Apollo version 1.0.0. I started getting this only when i updated gradlew to version 5.1.1. Do you have any workaround i can apply for now ?

@ghadly
Copy link

ghadly commented Aug 20, 2019

Woooohoooo 🎉 worked great in version 1.0.3-SNAPSHOT

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

8 participants