在跟着官网的步骤 执行 npm init egg --type=simple
然后 执行 npm run dev 就报了以下错
cache-require-paths: Failed saving cache: Error: ENOENT: no such file or directory, open 'D:\Work\xqj\xqj-admin\s\node_modules\egg-bin\node_modules\egg-ts-helper\.tmp\requirePaths.json'
internal/modules/cjs/loader.js:1023
throw err;
^
Error: Cannot find module 'diagnostics_channel'
这个错误的原因是 在代码中引用了 diagnostics_channel 模块,但这个模块是 node v15 版本的内置模块。所以升级到v15 以上即可。
node v16 下载地址
https://cdn.npmmirror.com/binaries/node/v16.12.0/node-v16.12.0-x86.msi