use*_*987 5 javascript node.js npm typescript
寻求有关如何调试此编译器错误的建议:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ******@1.1.0 dev: `NODE_ENV=development ts-node ./src/server.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ******@1.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
Run Code Online (Sandbox Code Playgroud)
这在运行时出现ts-node ./src/server.ts或node build/server.js
tsc 工作没有错误。
tsconfig.json:
{
"compilerOptions": {
"lib": [
"es2018",
"dom",
"esnext.asynciterable"
],
"target": "es2018",
"module": "commonjs",
"outDir": "build",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"sourceMap": false,
"rootDirs": ["src", "../shared"]
// "rootDir": "src"
},
"exclude": [
"node_modules",
"**/*.spec.ts",
"**/*.test.ts"
],
"references": [
{ "path": "../shared" }
]
}
Run Code Online (Sandbox Code Playgroud)
我确实在 tsconfig 中做了一些更改,我想这会导致一些导入失败,但是代码库很大,我真的需要一些指向代码中导致错误的确切行的指针。特别是在tsc没有错误的情况下混淆运行。
更新:
The issue was with some imports and fixed, However facing similar one again. Know the reason of the current issue - for some reason the imports from shared project (as in here https://www.typescriptlang.org/docs/handbook/project-references.html) are not loaded (despite that they are working in other modules and tsconfig.json is the same with other modules). no particular error, just this npm ERR! code ELIFECYCLE npm ERR! errno 1.
Question:
However the main question of this topic is not the solution of the particularly this problem, but how to debug this kind of import problems where all available log is basically npm ERR! code ELIFECYCLE npm ERR! errno 1. I am facing this kind of issues periodically and every time it takes a lot of time to resolve since the only way to debug i know about is to comment chunks of code which might be associated with the possibly failed imports and sometimes this process could take hours.
| 归档时间: |
|
| 查看次数: |
4586 次 |
| 最近记录: |