(react) 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.
See original GitHub issuePlease make sure you have read the submission guidelines before posting an issue
Prerequisites
Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- I am running the latest version
- I checked the documentation (nx.dev) and found no answer
- I checked to make sure that this issue has not already been filed
- I’m reporting the issue to the correct repository (not related to React, Angular or any dependency)
Failure Information (for bugs)
I’m getting this 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.
I had types “node” in tsconfig intalled package etc.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
TypeScript getting error TS2304: 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...
Read more >Cannot find name 'require' Error in TypeScript | bobbyhadz
To solve the "Cannot find name require" error, install the node types by running npm i -D @types/node . If the error is...
Read more >Fix the Cannot Find Name 'require' Error in TypeScript
To fix the “cannot find name 'require'” error in TypeScript, install the @types/node package into your project by running npm i -D ...
Read more >cannot find name 'require', Do you need to install ... - YouTube
cannot find name ' require ', Do you need to install type definitions for node ? Try ' npm install --save-dev @ types/node...
Read more >cannot find name 'require'. do you need to install type ...
do you need to install type definitions for node? try `npm i --save-dev @types/node` and then add 'node' to the types field in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey just in case anyone needs to solve this in the future:
Make sure you update the
tsconfig.lib.json
as well as thetsconfig.json
inside the lib.The
tsconfig.lib.json
in my project had an empty"types":[]
which was overwriting thetsconfig.json
’s types declaration!This is a fresh project and getting this error