I also encountered this issue, which appears to be related to the Auto Import feature in VSCode. Even disabling all extensions does not seem to resolve it.
A temporary fix is to turn off autoimports in settings.
For Javascript users:
"javascript.suggest.autoImports": false
For Typescript users:
"typescript.suggest.autoImports": false
https://i.sstatic.net/DZQy3.png
UPDATE: The problem with autoimporting is caused by a code snippet within a package further down the dependency tree.
declare module "console" {
export = console;
}
This faulty package could be located in your local node_modules folder or in a globally installed referenced package.
- Search your local node_modules for
declare module "console"
- If found in a local package, use
npm list [packageName]
to identify which package in package.json relies on the one containing the console code.
If the code is not in your local node_modules, you can try either of these:
Delete packages one by one in package.json
Look for the console code in globally installed modules that might be referenced by packages in your project
%USERPROFILE%\AppData\Roaming\npm\node_modules
%USERPROFILE%\AppData\Local\Microsoft\TypeScript
I understand this solution is not straightforward, but hopefully, it aids you. In my case, I traced the issue back to react-native-copilot -> rimraf -> node, where the problematic console code was present. Removing react-native-copilot resolved the issue.