I am working on an 1.14 SPFX web part, but inside the .ts file we are getting reference errors on almost all the libraries as shown in this picture:-
For example, on the first reference error "Cannot find module 'react' or its corresponding type declarations... i tried those commands:-
npm install react
npm install --save-dev @types/react
npm i @microsoft/rush-stack-compiler-3.9
but did not fix anything.. any advice on this please?
Thanks
Hi @john john ,
According to my research and testing, please try to set moduleResolution to node in your tsconfig.json file.
If the error is not resolved, try to delete your
node_modules and
package-lock.json files, re-run
npm install and
restart your IDE. You can run the following command:
rm -rf node_modules package-lock.json
npm install
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.