pnpm dlx ts-node boop.ts --verbose
Created
July 26, 2023 21:32
-
-
Save tyre/8493803ae8ac4dcd6f942b7ac1966df2 to your computer and use it in GitHub Desktop.
NOOOOOOOOOOde
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dotenv/config"; | |
import { AutoTokenizer } from "@xenova/transformers"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "playground", | |
"version": "1.0.0", | |
"description": "", | |
"dependencies": { | |
"@types/node": "20.4.5", | |
"@xenova/transformers": "2.4.2", | |
"dotenv": "8.2.0", | |
"typescript": "^5.1.6" | |
}, | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"engines": { | |
"node": ">=18.0.0" | |
}, | |
"type": "module", | |
"keywords": [], | |
"author": "", | |
"license": "ISC" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"esModuleInterop": true, | |
"forceConsistentCasingInFileNames": true, | |
"allowJs": true, | |
"isolatedModules": true, | |
"moduleResolution": "NodeNext", | |
"module": "NodeNext", | |
"preserveWatchOutput": true, | |
"skipLibCheck": true, | |
"noEmit": true, | |
"strict": true, | |
"lib": [ | |
"es2015", | |
"dom" | |
], | |
"target": "ES2015" | |
}, | |
"ts-node": { | |
"esm": true | |
}, | |
"exclude": [ | |
"node_modules" | |
] | |
} |
As shown:
/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366
throw new ERR_MODULE_NOT_FOUND(
^
CustomError: Cannot find module '/Users/tyre77/workspace/llm/ts-hub/playground/node_modules/dotenv/config' imported from /Users/tyre77/workspace/llm/ts-hub/playground/mods/boop.ts
at finalizeResolution (/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366:11)
at moduleResolve (/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:801:10)
at Object.defaultResolve (/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
at /Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/esm.ts:218:35
at entrypointFallback (/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/esm.ts:168:34)
at /Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/esm.ts:217:14
at addShortCircuitFlag (/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/esm.ts:409:21)
at resolve (/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/esm.ts:197:12)
at resolve (/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2457/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/child/child-loader.ts:15:39)
at nextResolve (node:internal/modules/esm/loader:163:28)
ERROR Command failed with exit code 1: ts-node boop.ts --verbose
removing "type": "module"
/Users/tyre77/Library/pnpm/store/v3/tmp/dlx-2497/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
boop.ts:2:31 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@xenova/transformers")' call instead.
To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `"type": "module"` to '/Users/tyre77/workspace/llm/ts-hub/playground/mods/package.json'.
2 import { AutoTokenizer } from "@xenova/transformers";
~~~~~~~~~~~~~~~~~~~~~~
without:
"ts-node": {
"esm": true
},
in tsconfig.json
:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/tyre77/workspace/llm/ts-hub/playground/mods/boop.ts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With: