89

I have the following problem: phpstorm do not recognize jquery methods and here and there I see

enter image description here

Unresolved function or method $()

This was bugging me for sometime but finally I tried to get rid of it with File->Settings->JavaScript->Libraries and adding jquery as a global / project.

My library setup looks like this:enter image description here

But is has not changed anything. I still see those pesky notices. Does anyone know how to get rid of them?

3
  • 2
    Please show screenshot of your Library setup for jQuery. Commented Feb 7, 2014 at 9:53
  • OK .. so you are using jQuery v1.11. I do see the same behaviour when using 1.11.0 .. but 1.10.2 works just fine. I think it has something to do with "AMD-fy jQuery source" -- bugs.jquery.com/ticket/14113 -- looks like IDE has some issues figuring out this style. If you wish (and can) -- roll back to v1.10.2 -- changes there are not so dramatic/critical. Commented Feb 7, 2014 at 21:37
  • 1
    Actual ticket: youtrack.jetbrains.com/issue/WEB-10908 Commented Feb 13, 2014 at 10:26

5 Answers 5

154

There is a really stupid workaround,

Download the Library (in this case jQuery) from inside the IDE itself.

  • Open up settings (Ctrl + Alt + S on Linux)
  • Navigate to Languages & Frameworks -> Javascript -> Libraries
  • Click Download and choose jQuery

Hopefully the errors will vanish

EDIT: After running the IDE through Fiddler, I realised this only solves the problem because of the version the IDE downloads.

So, the correct workaround is to Add older, non-AMD jQuery versions as a Global scoped Library and add the latest one as a Project scope library.

The latest non-AMD versions are:

1.10.2 for 1.x series. And, 2.0.0 for 2.x series.

Sign up to request clarification or add additional context in comments.

4 Comments

so stupid a workaround it almost feels like phpstorm devs wished for us to actually use that way...
As of PhpStorm 8, this is found in Settings -> Languages & Frameworks -> JavaScript -> Libraries
yeah well, they said pStorm 8.0.2 is supposed to have this issue solved already
Note that restarting the application may be needed.
15

I had the same issue with version 1.11.2, and resolved it simply by adding the uncompressed version into my js folder.

1 Comment

Should've been the answer. I added the un-compressed jquery version right next to my compressed jquery min. Followed by immediately adding the uncompressed version to my .gitignore file, so my production always uses the min version.
8

Just copy the uncompressed version of jQuery into your project folder. you don't even need to import it into your project, just copy it to javascript folder.

2 Comments

You still have to alter the <script src="../../js/jquery-ui.min.js"></script> statement to have it recognized.
The Webstorm dependency management is not dependent on altering js files(which is both good and bad) I think think the Phpstorm would be the same...
3

The jQuery v1.11.0 shows exactly the same behaviour here as well. At the same time previous version 1.10.2 works fine in IDE (no warnings).

I think it has something to do with "AMD-fy jQuery source" ticket (http://bugs.jquery.com/ticket/14113) -- looks like IDE has some issues figuring out this style.

If you wish (and can) -- roll back to jQuery v1.10.2 (which is like half a year old, which means it's stable and still good to use).

Hopefully IDE will be able to properly parse this new jQuery style in next release.


Actual ticket: http://youtrack.jetbrains.com/issue/WEB-10908

1 Comment

This is NOT a solution. Importing jQuery from IDE worked for me.
1

If you import both 1.11.0 and 1.10.2 in phpstorm it will be resolved

You don't have to rollback your project.

2 Comments

Hmm.. tried that (although it's 1.10.4 that I added - couldn't find 1.10.2) and it's still giving me the error. Any suggestions?
anything after 1.10.2 will not work, thats the last, non-AMD version they released

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.