yarn and not resolved referencing

I create a new project via yarn and add bootstrap as dependency.

{
"name": "test",
"dependencies": {
"bootstrap": "4.1",
}
}

I write a few lines like:

@include media-breakpoint-down(sm){
[…]
}

 

PHPStorm warns: Cannot find mixin 'media-breakpoint-down' But it is resolved on compiling.

 

What did I wrong?

 

Thank you

Bertram

8 comments

For me, the displayed warning is "Element 'media-breakpoint-down' is resolved only by name without use of explicit imports":

 

that is expected if the corresponding .scss file is not imported explicitly.

PhpStorm uses the following approach for elements resolving in SASS:

  • If element can be resolved to declaration from current file or from explicitly imported files, then it is just resolved

  • If element was not resolved after the first step (declaration is not found in current file/files explicitly imported into current file) then the IDE tries to resolve it just by name no matter which file it's declared in ('global' elements). Resolved element is marked by weak-warning inspection 'Resolved by name only', as the IDE can't know if this element is 'global' or just not imported by mistake. You can disable this inspection if you don't like to see these warnings.

  • If element still not resolved it is marked with warning 'Unresolved something'.

Adding import statement, like

@import "~bootstrap/scss/mixins"

should make the warning go away

0

Hi Elena,

 

thank you for the fast answer. I just was wondering, because clicking on media-breakpoint-down didn't lead me to the function. Local mixins are found immediately. So the index seems not to resolved correctly.  Or do I miss a thing?

Greetings
Bertram

 

0

Navigation works for me even if the file is not imported:

 

Make sure that node_modules/bootstrap folder is not excluded from your project

0

There is no directory with node_modules. 🙈

 

But I use yarn and the dependencies are installed correct.

0

where are they installed? You need to install bootstrap in your project to make stylesheets available, installing them globally won't work

0

The files in node_modules are definitely in the project root:

I have no clue, why the node_modules directory is not shown in my files.

0

check Ignore files and folders in Settings | Editor | File Types - do you have node_modules; listed there?

0

OMG, that's it. I have no idea, why node_modules was set here `__pycache__;_svn;node_modules ;rcs;` Unfortunarley the search didn't found it, too.

I am so grateful, thank you very much.
Bertram

1

Please sign in to leave a comment.