Working on a Node.js project I get suggestions (Alt + Enter) to import using ES6 when my Node.js does not support the import statement. Can I add suggestions that use require? Auto import saves so much time...
The manipulateName method definition:
const manipulateName = (layout, method) => {
layout.name = method(layout.name);
return layout;
}
and ...
module.exports = {
manipulateName,
...
}
Please make sure that Node.js Core library is enabled for your project (Preferences | Languages & Frameworks | Node.js and NPM, Node.js Core library).
See Missing require() statement inspection (Preferences | Editor | InspectionsJavaScript | Node.js) description:
Checks that all modules are referenced through "require()".
Suggests inserting the "require()" call.
Works only in files in the scope of "Node.js Core" JavaScript library.
Webstorm 2019.2.
In my case I tried to enable "Coding assistance for Node.js" but the following happened:
Check "Coding assistance for Node.js" --> Ok --> Re-open "Node.js and NPM" --> Coding Assistance is not checked.
I did the following:
1. Help --> Find Action --> Registry --> search for "nodejs.core.library.use.typings" --> disable it.
2. File --> "Invalidate and Restart"
3. Go To Terminal --> type:
/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js install @types/node --ignore-scripts
4. Settings --> "Node.js and NPM" --> checked "Coding Assistance for Node.js"
Solved! Check also Jetbrains Issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With