Код: Выделить всё
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module '/Users//projects/course tree/course_tree/scripts/script.js'
at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Function._load (node:internal/modules/cjs/loader:1055:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
at node:internal/main/run_main_module:36:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v22.14.0
< /code>
Я, честно говоря, не знаю, что вызывает эту ошибку. Я попытался искать в стеке, но я не смог найти решение моей проблемы. это: < /p>
{
"compilerOptions": {
"target": "es2016",
"module": "Node16",
"moduleResolution": "nodenext",
"outDir": "./ts-out",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"type": "module",
"include": ["./ts-in"],
"exclude": [],
}
< /code>
В начале я попытался создать файл D.TS для каждого из моих файлов .ts, так как я получал синтаксические ошибки в своих операторах импорта. Странно, ошибки исчезли только тогда, когда я заменил операторы относительного пути ../ tsout/ .js Подробнее здесь: https://stackoverflow.com/questions/796 ... -err-error