所以我找到了答案。不明显,我偶然发现了。
我已经安装了
ts-lint
(见上面的package.json),我看到了一个引用
tslint
(没有连字符)。
所以我搬走了
TS绒布
并安装
特斯林特
就像冠军一样。我不知道有什么区别,但是连字符的那个在我的项目配置中不起作用。另外,不带连字符的安装版本号高于带连字符的。
查看包含工作依赖项的my new package.json:
{
"name": "testapi",
"version": "0.0.1",
"description": "a hello world api",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "npx ts-node src/app.ts",
"lint": "npx tslint --project ./ 'src/**/*.ts?(x)' $@"
},
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^6.2.0",
"fastify": "^1.13.2",
"ts-node": "^7.0.1"
},
"devDependencies": {
"@types/node": "^10.12.15",
"tslint": "^5.12.0",
"typescript": "^3.2.2"
}
}
当在Docker容器中运行时,仅使用public node:10映像即可。它不需要dockerfile来安装任何全局依赖项。