Cannot resolve file warning

In my html files I have such codes:

<img src="/img/some/myphoto.jpg" width="240" height="182" alt="myimage"/>

phpStorm gives me
"Cannot resolve directory some"
"Cannot resolve file myphoto.jpg"
errors.

I know that this directory and file exists inside one my my subfolders of project.
I don't want to suppress this warning because this information is valuable for me.
How can I solve this and show proper folder path for my project and file?
13 comments
Comment actions Permalink

Hi there,

Mark parent folder of that /img/ folder as Resource Root.

9
Comment actions Permalink

Solved. Thank you very much.

0
Comment actions Permalink

FYI - I found this solution numerous places yet could not get it to work. After numerous attempts of setting root directory properly, the error messages just would not clear. Finally, I made a change to the file and saved and the errors disappeared!

0
Comment actions Permalink

Hi,

How tgo mark parent folder as Ressource Root ?

Regards

0
Comment actions Permalink

@Amaury

Either "Settings/Preferences | Directories" (https://www.jetbrains.com/help/phpstorm/directories.html) or via right click in the Project View panel and then "Mark Directory as..."

0
Comment actions Permalink

Intellij IDEA 2017.2.3 with the root marked as resource root still doesn't find the files placed inside.

0
Comment actions Permalink

please attach a screenshot illustrating the issue

 

 

0
Comment actions Permalink

Tried marking as resource root, no success..

0
Comment actions Permalink

If you marked your project root as Resource Root, completion will work in a way relative to it so you should have public/images/bckg-img.jpg resolved.

You set the full absolute path there - IDE cannot resolve this against current project structure.

0
Comment actions Permalink

Thanks, Vladimir!

0
Comment actions Permalink

I have the same issue.

I have two js files in a directory that is marked as a resource. root.

calendarDataInput.js gets the warning: Cannot resolve file.

calendarDataInput20110220a.js does not get a warning.

As mentioned above I tried editing the file to see if that would clear the warning. It did not.

Any suggestions?

Here is a screen shot

 

0
Comment actions Permalink

@Ben Bachrach

IDE is correct :)

Please check the actual file name and the reference (I mean value in "src" attribute) -- they are pointing to differently named files.

calendardatAinput and calendardatEinput -- I've used capitals to highlight the difference.

0
Comment actions Permalink

Sorry, I see the typo now.

 

0

Please sign in to leave a comment.