【发布时间】:2019-09-18 07:30:26
【问题描述】:
require 关键字不适用于 angular,抛出错误:
src/app/app.component.ts(8,16): error TS2591: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
我该如何解决?其实我也用nodejs正确安装了它,但没有工作。
【问题讨论】:
-
查看我的回答会对你有帮助
-
它不工作
-
重启你的 Angular cli 服务器并关闭 vs 代码并再次打开
-
完成了,没有任何反应
标签: javascript node.js angular typescript single-page-application