vue3 setup + ts + vite 项目问题解决 @types/node 提示

vue3 setup + ts + vite 项目问题解决:Cannot find module ... or its corresponding type declarations.(ts2307)

node 提示:
Cannot find module 'path' or its corresponding type declarations.
Cannot find module 'node:url' or its corresponding type declarations.

1.安装 types

yarn add @types/node

2.在tsconfig.json中添加

"compilerOptions": {
    "types": [  "node" ]
}