I got Unable to compile TypeScript error

[failsafe] Script ‘clean’ exited with code 0
[test:execute]
[test:execute] > @serenity-js/serenity-js-cucumber-template@1.0.0 test:execute
[test:execute] > cucumber-js --tags=’@test
[test:execute]
[test:execute] TSError: ⨯ Unable to compile TypeScript:
[test:execute] src/step_definitions/DEMO_RESTAPI.steps.ts(5,24): error TS2307: Cannot find module ‘…/dto/messageDto’ or its corresponding type declarations.
[test:execute]

here is my github repo https://github.com/LayMui/serenityjs-rest/tree/master/.circleci

1 Like

[test:execute] TSError: ⨯ Unable to compile TypeScript:
[test:execute] src/step_definitions/DEMO_RESTAPI.steps.ts(5,28): error TS2307: Cannot find module ‘…/dto/messageDto’ or its corresponding type declarations.
[test:execute]
[test:execute] at createTSError (/home/circleci/project/node_modules/ts-node/src/index.ts:692:12)
[test:execute] at reportTSError (/home/circleci/project/node_modules/ts-node/src/index.ts:696:19)
[test:execute] at getOutput (/home/circleci/project/node_modules/ts-node/src/index.ts:883:36)
[test:execute] at Object.compile (/home/circleci/project/node_modules/ts-node/src/index.ts:1185:30)
[

Hi @LayMui ,

Could you share the build link on CircleCI so that I can see the build failure for further diagnosis?

Thank you!

thanks Kelvintaywl

now my issue is not able start the server at localhost:8080 at circleci
which I am able to do so locally

here is build link
https://app.circleci.com/pipelines/github/LayMui/serenityjs-rest/16/workflows/6b34975c-10f8-482a-be29-39fa720739b5/jobs/16

Hi @LayMui

Thank you for sharing your build link.

I took a look at the build information, and noticed that your web server likely did not start.
The ./startwebserver.sh file is trying to run a Apache Tomcat server which likely needs java runtime.
We can see the messsage printed at https://app.circleci.com/pipelines/github/LayMui/serenityjs-rest/16/workflows/6b34975c-10f8-482a-be29-39fa720739b5/jobs/16?invite=true#step-108-3:

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program

I think ensuring the Tomcat server is indeed started would solve your issue.

One thing you can do to ensure this is to make sure your executor has Java runtime set up.
Based on your config, it seems you are using cimg/base:2021.04 as the docker executor but I suspect it may not come with Java runtime.

Perhaps, you may want to use the cimg/openjdk image instead.

I have change the docker image
docker:
- image: cimg/openjdk:1.14-node

Starting container cimg/openjdk:1.14-node
Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.
image cache not found on this host, downloading cimg/openjdk:1.14-node

Error response from daemon: manifest for cimg/openjdk:1.14-node not found: manifest unknown: manifest unknown

https://app.circleci.com/pipelines/github/LayMui/serenityjs-rest/18/workflows/44ce6b3a-c960-4006-b024-e178138fc99d/jobs/18

I change to this image

  • image: circleci/openjdk:latest

still unable to connect to the localhost:8080 server
https://app.circleci.com/pipelines/github/LayMui/serenityjs-rest/20/workflows/fd8db5dd-ff2a-4901-91e0-78b9aef1de28/jobs/20