How can I fix WebStorm warning "Unresolved function or method" for "require" (Firefox Add-on SDK)

intellij fix all inspections
intellij enable warnings
intellij hide warnings
how to fix checkstyle errors in intellij
intellij quick fix like eclipse
intellij redundant suppression
webstorm disable eslint
webstorm disable tslint

I'm using WebStorm 7 for Firefox Add-on SDK development.

WebStorm shows a warning: "Unresolved function or method" for require().

I want to get rid of the warning.

var pageMod = require("sdk/page-mod");

NOTE:I already configured JavaScript-library (refer /lib/sdk globals).

Environment:

  • WebStorm 7.0.2
  • Windows 7 64bit
  • Firefox Add-on SDK 1.15beta1

Do you mean that require() is not resolved? You need to either add require.js to your project or enable Node.js Globals predefined library in Settings/Languages and Frameworks/JavaScript/Libraries.

(Edited settings path by @yurik)

In WebStorm 2016.x-2017.x: make sure that the Node.js Core library is enabled in Settings (Preferences) | Languages & Frameworks | Node.js and NPM

In IntelliJ 2018.3.2, go to Settings (Preferences) | Languages & Frameworks | Node.js and NPM and enable Coding assistance for Node.js

Quick-Fixes for Code Issues - Help, Use the issue highlighting in the editor and the marker bar to navigate to a specific code issue. Set the caret at the highlighted issue. Press Alt+Enter or click the action indicator to the left of the caret to open the action list. Click the desired quick-fix or select it using arrow keys and then press Enter . Disable JetBrains Inspections and get the ESLint plugin. The only thing that File | Invalidate caches and restart does for me is reset it long enough to trick me into thinking the error is gone. Once the inspections run again the error comes back like a gift that keeps on giving.

Webstorm 11 and 2016.2.3

Enable Node.js Core library in Webstorm settings.

Disable and suppress inspections, to hide the disabled inspection alerts. Re-enable inspections. Click the Hector icon the  Solution on Webstorm 2016.3 1) click on ALT+F12 (open treminal) 2) run the command: npm install require.js I'm using WebStorm 7 for Firefox Add-on SDK development.

In PHPStorm, it's a bit easier: you can just search for NPM in settings or:

File > Settings > Language & Frameworks > Node.js and NPM

Then click the enable button (apparently in new versions, it is called "Coding assistance for Node").

Get results and fix problems - Help, If an inspection has detected a problem in your code, you can quickly apply a fix in the editor. Place the caret at the highlighted piece of code and press Alt+Enter​  WebStorm 3.0 shows warnings if optional arguments are not set.This is so annoying me. WebStorm 2.1 didn't show those.And also WebStorm 3.0 shows warnings if we set optional arguments in ajax functi

After spending an hour trying to get this to work using all solutions found online, this finally did the trick!

File -> Invalidate Caches/Restart...

How can I fix WebStorm warning "Unresolved function or method" for , Do you mean that require() is not resolved? You need to either add require.js to your project or enable Node.js Globals predefined library in  I am running Webstorm 2018.3 on Windows 10 and using Chrome Canary 72.0.3623.0 64-bit. Recently, when I try to debug webpages with clientside JS, Chrome opens, but the webpage doesn't load. It also says that it can't connect to the JetBrains Chrome extension despite the extension reporting that its connecting to WebStorm.

Working with Intellj 2016, Angular2, and Typescript... the only thing that worked for me was to get the Typescript Definitions for NodeJS

Get node.d.ts from DefinitelyTyped on GitHub

Or just run:

npm install @types/node --save-dev

Then in tsconfig.json, include

"types": [
     "node"
  ]

ESLint, . In the right-hand pane, clear the Use rule severity from the configuration file checkbox and select the severity level to use instead of the default one. Install the Toolbox App Download the installer.exe from the Toolbox App web page. Run the installer and follow the wizard steps. After you run the Toolbox App, click its icon in the notification area and select which product and version you want to install.

WebStorm Setup · Prettier, or select it using arrow keys and then press Enter . Open the Toolbox App and click the screw nut icon in the top right corner. In the Toolbox App Settings, enable Generate shell scripts. If necessary, change the shell scripts location. If you have several versions of the same IDE, the Toolbox App generates a shell script for each version with a unique name.

"Unresolved function or method" inspection in WebStorm/PHPStorm , Using Prettier in WebStorm. If you are using ESLint with eslint-plugin-prettier, use the Fix ESLint Problems action to reformat the current file – find it using Find​  All I want to do, is find out how can I select all twitterAccounts[0] with multiple cursor so I can replace all of them with another piece of code. Shortcut should be perfect. P.S. Sorry if this question is dummy. Just couldn't fint an answer at google and among my friends who are using WebStorm. Piece

How to resolve and fix Unresolved function variable or method , There is a weak warning in PHPStorm when using colors: "Unresolved function or method". Maybe you should use JSDoc in your source code to fix this or  Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. How can I fix WebStorm warning “Unresolved function

Comments
  • var pageMod = new require("sdk/page-mod"); may solve the issue. Notice the 'new' in the code
  • I had the same problem with WebStorm 8
  • Thank you lena. and sorry my english poor.(>_<;) I want to cleanup warning on webstorm-editor. (script execution is no problem. ) Firefox-Addon-SDK conforms commonjs, but not uses node.js. "require" method defined <sdkroot>/app-extension/bootstrap.js I set bootstrap.js to External Libraries, but not clear "unresolved" warning. <code> let require = cuddlefish.Require(loader, module); function loadSandbox(uri) { let sandbox = ... sandbox.require = function (id) { return Object.freeze({ ... }); }; return sandbox; </code>
  • Useful answer! BTW, in my webstorm 9, The location is: Language & Frameworks -> Javascript -> Libraries ; Another approach is to search for "Libraries"
  • In Webstorm 9, you can also right-click on "require", and choose "Use Javascript Library->Node.js Globals"
  • Enable the NodeJS plugin if 'Node.js Globals' is missing from the library list.
  • FYI: I had to turn my node assist OFF, invalid caches and restart WebStorm and then turn it back ON to get it working. WebStorm 2018.3.5
  • I just wanted to add on that I had the same problem and although my core library was already enabled, going to the settings screen seemed to fix the problem.
  • didn't work for me using typescript with the latest version of node and webstorm. Still on the hunt for a fix for us angular2 people. Usage inside a component definition styles: [require('./app.component.css')]
  • I still have the error in the compiler error TS2304: Cannot find name 'require'.