-- Runing a TS files code from a Next app created with `npm` command --

Hello devs, i m bulding features for an app. that integrates users repo into the code in order to obtain info for that project , currently I run out of solutions to run this file where I wrote the github logic Here s the output in the terminal :
No description
9 Replies
Beyond^sight
Beyond^sightOP2w ago
that s the actual tsconfig.json : { "compilerOptions": { "target": "ESNext", "module": "ESNext", "moduleResolution": "Node", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "strict": true, "skipLibCheck": true, "noEmit": true, "baseUrl": ".", "paths": { "src/*": ["./src/*"] } }, "include": [ "src", ".eslintrc.cjs", "next-env.d.ts", "src/**/*.mts", "src/**/*.mjs", "src/**/*.ts", "src/**/*.tsx", ".next/types/**/*.ts" ] } pls 🧠 let me know what could i do 2 run the github.ts file whitout problems 😃
mukomo
mukomo2w ago
I thought you couldn't directly run typescript files from npm without a workaround
bigciri
bigciri2w ago
did you try to remove "type":"module" from your config? i mean from package.json
upside_downside
try npx tsx src/lib/github.ts
Reptiloid
Reptiloid2w ago
You can't run .ts files using node. You need to transpile it first using tsc, but you are probably looking for something like tsx. You can run it using npx or install as a dev dependency and change the script to tsx ./src/lib/github.ts
Beyond^sight
Beyond^sightOP2w ago
i ve done that
Beyond^sight
Beyond^sightOP2w ago
also tried with "github": "npx tsx src/lib/github.ts",
No description
mukomo
mukomo2w ago
Try this instead of npm run github
Beyond^sight
Beyond^sightOP2w ago
📝 Update : Have installed the npx into the app then the github command has worked, ready to move foward, appreciate y all suport ❤️

Did you find this page helpful?