首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >angular universal找不到名称'expect‘

angular universal找不到名称'expect‘
EN

Stack Overflow用户
提问于 2019-02-12 18:55:58
回答 1查看 251关注 0票数 0

我需要些帮助。当我运行npm run build:ssr && npm run serve:ssr时,我得到以下错误

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2020-01-16 04:57:45

在tsconfig.json文件中,添加以下行:

代码语言:javascript
复制
"exclude": [
    "node_modules",
    "e2e",
    "**/*.spec.ts"
  ]

这告诉编译器在编译时忽略node_modules和e2e目录以及任何.spec文件。在集成Universal之后,我在Angular 8中遇到了这个问题,这些方法可以在每个组件的规范文件中找到。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54648499

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档