-- 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 :

9 Replies
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 😃I thought you couldn't directly run typescript files from npm without a workaround
did you try to remove "type":"module" from your config?
i mean from package.json
try
npx tsx src/lib/github.tsYou 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.tsi ve done that
also tried with
"github": "npx tsx src/lib/github.ts",
Try this instead of
npm run github📝 Update : Have installed the
npx into the app then the github command has worked, ready to move foward, appreciate y all suport ❤️