我需要些帮助。当我运行npm run build:ssr && npm run serve:ssr时,我得到以下错误
TS2304: Cannot find name 'expect'.
TS2304: Cannot find name 'it'.
TS2304: Cannot find name 'fail'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! simplestate@0.0.1 webpack:server: `webpack --config webpack.server.config.js --progress --colors`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the simplestate@0.0.1 webpack:server 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:
npm ERR! C:\Users\USER\AppData\Roaming\npm-cache\_logs\2019-02-12T08_57_37_447Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! simplestate@0.0.1 build:ssr: `npm run build:client-and-server-bundles && npm run webpack:server`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the simplestate@0.0.1 build:ssr 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:
npm ERR! C:\Users\USER\AppData\Roaming\npm-cache\_logs\2019-02-12T08_57_37_479Z-debug.log发布于 2020-01-16 04:57:45
在tsconfig.json文件中,添加以下行:
"exclude": [
"node_modules",
"e2e",
"**/*.spec.ts"
]这告诉编译器在编译时忽略node_modules和e2e目录以及任何.spec文件。在集成Universal之后,我在Angular 8中遇到了这个问题,这些方法可以在每个组件的规范文件中找到。
https://stackoverflow.com/questions/54648499
复制相似问题