错误现象
> npm run lint:js && npm run prettier && npm run tsc
Checking formatting...
All matched files use Prettier code style!
npm error Missing script: "tsc"
npm error
npm error To see a list of scripts, run:
npm error npm run
npm error A complete log of this run can be found in: C:\Users\turbo\AppData\Local\npm-cache\_logs\2024-10-12T06_30_22_873Z-debug-0.log
ELIFECYCLE Command failed with exit code 1.
错误原因
虽然安装了 tsc 但是这里的写的是 npm run tsc,也就是说 package.json 的 script 中的需要有 tsc
解决方法
在 package.json 中添加:
"scripts": {
"tsc": "tsc"
},
如果有其他的配置需求可以在后面添加,例如
"scripts": {
"tsc": "tsc --noEmit"
},