The problem (as outlined in typescript getting error TS2304: cannot find name ' require') is that the type definitions for node are not installed.
With a projected genned with @angular/cli 1.x, the specific steps should be:
Step 1: install @types/node with either of the following:
- npm install --save @types/node
- yarn add @types/node
Step 2: - edit your src/tsconfig.app.json file and add the following in place of the empty
"types": []
, which should already be there:...
"types": [ "node" ],
"typeRoots": [ "../node_modules/@types" ]
...
If I've missed anything, jot a comment and I'll edit my answer.
Không có nhận xét nào:
Đăng nhận xét