In Typescript, direct use of the require syntax in the case of unconfigured error ‘Cannot find name’ require ‘
why
Require is the syntax for node, and the runtime environment is not the Node environment.
plan
1. Install @types/node: NPM I @types/ node-s-d
2. Json :
compilerOptions
add an item:
{
"compilerOptions": {
// ...
"types": ["node"],
// ...
}
div>