Open flleeppyy opened 11 months ago
i have this issue as well :/ really frustrating only workaround i got is
node --no-warnings=ExperimentalWarning --loader ts-node/esm ./someDirectory/index.ts
FWIW - I ran into this issue just now and after banging my head against the wall for about 30 minutes, I realized the file I was calling fell under a pattern in my .gitignore file so it wasn't pulling into the build server I was running on. Dumb mistake on my part but my be an easy issue to overlook.
try to use tsx
instead. It works flawlessly for me.
Search Terms
If I try to run the script src/index.ts, it results in this error
But if I run the script with script/index.js, I get this error
No where am I importing "imaginaryUncacheableRequireResolveScript" and looking that up on Google yields nothing.
Expected Behavior
It runs my code with either of the file extensions I provide
Actual Behavior
The errors above.
Steps to reproduce the problem
running pnpm/npm ts-node src/index.js with my tsconfig (making sure tpye is set to module in package.json)
Minimal reproduction
https://github.com/flleeppyy/ts-node-repros https://github.com/TypeStrong/ts-node-repros/pull/37
Specifications
ts-node v10.9.2 node v20.10.0 compiler v5.3.3
{ "name": "relatrack-backend", "version": "1.0.0", "description": "Backend to Relatrack, an inventory solution.", "main": "src/index.ts", "type": "module", "scripts": { "dev": "nodemon src/index.js", "start": "cd dist && node index.js", "build": "tsc", "lint": "eslint . --ext .js,.ts --fix --ignore-path .gitignore && prettier --write --ignore-path .gitignore .", "db:genschema": "cross-env node --no-warnings --loader ts-node/esm -r ts-node/register ./src/utils/dbSchemaParser.ts" }, "engines": { "node": ">=20.6.0", "pnpm": ">=8.0.0" }, "keywords": [], "author": { "name": "Chen Jinkerson", "email": "flleeppyybusiness@gmail.com", "url": "https://fleepy.tv" }, "license": "MIT", "dependencies": { "@fastify/cors": "^8.5.0", "@fastify/helmet": "^11.1.1", "@fastify/multipart": "^8.0.0", "@typescript-eslint/types": "^6.15.0", "ajv": "^8.12.0", "ajv-keywords": "^5.1.0", "bcryptjs": "^2.4.3", "better-sqlite3": "^9.2.2", "cross-env": "^7.0.3", "dotenv": "^16.3.1", "fastify": "^4.25.1", "fastify-plugin": "^4.5.1", "image-size": "^1.0.2", "jose": "^5.1.3", "json-schema-to-typescript": "^13.1.1", "jsonwebtoken": "^8.5.1", "knex": "^2.5.1", "pino": "^8.17.1", "pino-pretty": "^10.3.0", "sqlite3": "^5.1.6", "ts-node": "^10.9.2", "tslib": "^2.6.2" }, "devDependencies": { "@espimarisa/eslint-config": "^4.2.0", "@types/bcryptjs": "^2.4.6", "@types/jsonwebtoken": "^8.5.9", "@types/node": "^20.10.5", "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", "@typescript-eslint/typescript-estree": "^6.15.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-unicorn": "^49.0.0", "nodemon": "^3.0.2", "prettier": "^3.1.1", "typescript": "^5.3.3" } }