Alternate location for node_modules
I'm using external framework which has a bug that my node_modules needs to be empty. This bug is not likely to be fixed fast so I'm looking for workaround. Is it possible to specify some other directory to serve as node_modules for code sense? I'm working on Angular 2 components and Webstorm's support in that regard is really good but without Angular modules in node_modules this feature is not working. I'd like to use npm install, rename directory and then tell Webstorm to use that directory as if it was node_modules. Is this possible?
Please sign in to leave a comment.
I can suggest trying a workaround from https://youtrack.jetbrains.com/issue/WEB-19476#comment=27-1255547:
- rename your project node_modules to some other name (dummy, for example)
- in Run | Edit configurations, expand Defaults node, select Node.js
- in default Node.js run configuration, press ellipsis button next to Environment variables: field
- add NODE_PATH variable there, specify a full path to dummy folder as a value
- in Project tool window, mark dummy folder as Resource root
- reopen the project - after re-indexing, you will see that @angular modules are resolved, directives recognized, etc.
But you will likely still face issues with TypeScript and Angular services, TSLint, ect., as the hack I've suggested doesn't affect external services