I am new to Node.js development and I have installed WebStorm from JetBrains to use it as my JavaScript IDE.
So I am following a tutorial in Udemy and I have come to notice the following problem.
I installed some modules with npm from WebStorm Console and although my JS script is working as intended, WebStorm autocompletion for the npm modules is not working.
Coding assistance for Node.js in my settings is marked! What do I do wrong?
The problems occur because of the weird way properties are defined.
For example, in chalk package they are generated dynamically using Object.defineProperty(this, styleName, {value: builder});, where the styleName is a color name you use in your code. There is no way to resolve them when analyzing file statically.
Normally installing Typescript stubs can be used as a workaround. But this doesn't work for validator due to WEB-43528.
chulk typings are included in package distribution, but not resolved because the required fields in package.json are missing. As a workaround, open node_modules/chalk/package.json and add "types": "index.d.ts", to it:
this should help:
Related
I'm having problems importing my functional component BusinessCard (declared here https://github.com/HenryFBP/react-business-card-hfbp/blob/master/src/BusinessCard.tsx#L20)
into a different project (here https://github.com/HenryFBP/personal-website-react/blob/master/src/pages/PageContact.tsx#L3).
I used npm link react-business-card-hfbp, and I can see the symlinked folder, but I must be doing the export incorrectly or don't understand package.json.
I have also tried installing from https://www.npmjs.com/package/react-business-card-hfbp/ but that does not seem to work either.
The error (below) from webpack is Module '"react-business-card-hfbp"' has no exported member 'BusinessCard'.. I tried so many different combinations, edited package.json quite a lot, but I am stuck on this.
I'm sure the answer is simple, I just don't have enough experience with Node Modules to understand what is going on.
Thanks so much <3
I fixed it! With the help of a kind person on "Reactiflux" Discord server.
TL;DR: I was not compiling it into a module correctly. I should have used parcel to compile it into a module. I thought that TypeScript could be included in modules - this is apparently not correct, you must somehow turn it all into JavaScript first.
Working code:
npm run build
npm publish
Working package.json:
https://github.com/HenryFBP/react-business-card-hfbp/blob/master/package.json#L42
I am working on a project created by others in Node.JS.
Noticed a pattern I've never used before.
All the inside imports are used with #.
ex: import Config from '#config/config';
Where config is a file inside /src/config/config.js.
Now, it's working flowlessly but WebStorm keeps complain about Module is not installed and suggest me to Install #config/config as dev dependency.
The real issue behind it is that WebStorm isn't able to autocomplete or help me in any other way regard those imports.
And how do I configure WebStorm to understand this?
Thanks!
I installed plugin for Intellij-Idea and it doesn`t work. Why can it be? As you can see the require word doesn`t become yellow.
And here is my plugin installed:
Please make sure to enable Node.js Core library in File | Settings | Languages & Frameworks | Node.js and NPM
I like to hover over things that are underlined to give me clues as to where to start. Your "path" and "require" are underlined. Your errors might say Unused local variable 'path' and Unresolved method or function require()
You might not have installed node in the current project. If you don't have node installed, try:
npm init to create a package.json file.
IntelliJ will walk you through creating the file. You can just press enter all the way through if you want and edit it later.
npm install express --save (replace express with whatever library you are trying to use) to save library in the dependencies list
Installing express
How can I fix WebStorm warning “Unresolved function or method” for “require”
I have a current project using aurelia.
I add the supertest library using npm.
npm install supertest --save-dev
Now add package to aurelia.json file
{
"name": "supertest",
"path": "../node_modules/supertest"
}
Now run aurelia build
au run
produces following error:
Tracing supertest...
error /Users/xxxxxxx/node_modules/supertest.js
Writing app-bundle.js...
I have tried everything I can think of to fix this. Any help would be appreciated.
I recommend you to use the aurelia-skeleton-navigation setup instead which uses Gulp and JSPM -> https://github.com/aurelia/skeleton-navigation. This will provide you more on control on your project.
Aurelia CLI is still on alpha, quoting from https://github.com/aurelia/cli:
Note: The CLI is currently in Alpha and as such may not be suitable for use on all projects yet. In particular, projects that need to make use of extensive 3rd party libraries or Aurelia plugins may not yet work or may require extensive custom configuration or workarounds. We are in the process of addressing these issues.
Emphasis on extensive custom configuration or workarounds lol. I myself tried the CLI initially but ended up switching to Gulp and JSPM setup instead because of the tedious importing of external libraries.
I'm working with Typescript >=2.0 on WebStorm 2016.2.2
When I use some node globals like __dirname or process, WebStorm is claming:
Corresponding file is not included in tsconfig.json
I have the Node.js Core library enabled. To affirm that it is enabled, I ran JSON.stringify and WebStorm was able to bring up all possible arguments lists. It's also worth mentioning that all of my code compiles fine, the editor errors are just an eye sore.