duffman / tspath

TypeScript path alias resolver
GNU Lesser General Public License v2.1
151 stars 33 forks source link

Error when used in CI/CD #53

Open cerbaire opened 1 year ago

cerbaire commented 1 year ago

When running tspath in a CI/CD script, I have the following error:

npx tspath -f -s TSPath v2.6.8 Try: 'tspath --help' for more information Parsing project: my-project /opt/gitlab-runner/builds/xxx/yyy/packages/my-project/ Indexing files... /opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/utils/utils.js:64 process.stdout.clearLine(); ^ TypeError: process.stdout.clearLine is not a function at Function.updateLine (/opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/utils/utils.js:64:24) at ParserEngine.walkSync (/opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/parser-engine.js:438:31) at ParserEngine.walkSync (/opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/parser-engine.js:435:33) at ParserEngine.walkSync (/opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/parser-engine.js:435:33) at ParserEngine. (/opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/parser-engine.js:148:18) at Generator.next () at /opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/parser-engine.js:31:71 at new Promise () at __awaiter (/opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/parser-engine.js:27:12) at ParserEngine.execute (/opt/gitlab-runner/builds/xxx/yyy/node_modules/tspath/parser-engine.js:112:16)

I can reproduce the same error local using the following command: npx tspath -f -s > debug.log

I don't see any difference on console output when using -s parameter.

Any idea?

Thanks for your support

The-White-Fang commented 1 year ago

Did you manage to fix it? I am encountering the same error.

The-White-Fang commented 1 year ago

For anyone who is looking for a solution to this. Use patch-package to patch tspath

Step 1: Install patch-package by npm i patch-package Step 2: Make changes to node_modules/tspath/utils/utils.js and node_modules/tspath/parser-engine.js Step 3: Run npx patch-package tspath Step 4: Commit the changes. Step 5: Add a docker step after npm i, npx patch-package. Step 6: Purge build cache docker system prune -a and rebuild the image.

cerbaire commented 1 year ago

Yes. I used resolve-tspaths instead of tspath.

Le mer. 1 nov. 2023 à 06:56, Abhishek Singh @.***> a écrit :

Did you manage to fix it? I am encountering the same error.

— Reply to this email directly, view it on GitHub https://github.com/duffman/tspath/issues/53#issuecomment-1788452719, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSB4ULY2SL5BYYX3NW4HTTYCHP75AVCNFSM6AAAAAA36MXCKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBYGQ2TENZRHE . You are receiving this because you authored the thread.Message ID: @.***>