WebStorm 2017.2.3. False "Module is not listed in package.json". It isn't reading my package.json.

I am getting "Module is not listed in package.json" waring for all the imports listed in my package.json.

They most definitely are listed in the package.json of this project...I see them there. dependencies and devDependencies.

It's as if the IDE is not reading my package.json file. Any suggestions?

0
11 comments

haven't heard of such issues. Is your package.json located in your project root folder? Do you have any symlinks in the project path?  Can you recreate the issue in a new project?

0
Avatar
Permanently deleted user

No, I do not see it in other projects. Is there someway to have it re-scan or recreate the project info for this one project?

0

No... Please provide the project so that I can advise on fixing the issue

0
Avatar
Permanently deleted user

It works as expected when I open it with WebStorm on my other machine. It isn't the code in this case...it's something wonky with the settings for this project on this particular computer. Hmmm..

0

Could you please provide your settings (File > Export settings) and your project (or at least a screenshot of project structure, package.json, screenshot of the error)?

0
Avatar
Permanently deleted user

Same problem here. Happened after one of the webstorm updates.

I can provide settings.jar, where to send it?

0
Avatar
Permanently deleted user

I've seen the same problem in PhpStorm  2017.2.1 and 2017.2.4. I also had the error 'unresolved function or method require'.

These steps cured both, but I'm not sure if all steps are necessary, steps 2 and 3 might be enough:

1. Settings -> Languages & Frameworks -> Javascript -> Libraries:  add 'Frameword Type: Node.js Core Modules'

2. Settings -> Node.js and NPM -> Enabled 'Node.js Core Library'

3. File -> Invalidate Caches / Restart

2
Avatar
Permanently deleted user

After applying the three steps mentioned in my previous post, PhpStorm stopped recognizing methods on my imported vue object, so I ended up deleting the '.idea' directory and re-configuring the project from scratch. Now everything's working.

0

2017.2.5 - Same issue.

const express = require('express');

Warning: Module is not listed in package.json

When I press Alt+Enter, WebStorm adds new record to package.json but warning not gone. WebStorm adds new record infinitely:

{
"name": "live-users-backend",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "latest",
"express": "latest",
"express": "latest",
"express": "latest"
},
"devDependencies": {
"express": "latest",
"express": "latest"
}
}
0

OK, "Invalidate Caches / Restart" solved the problem but strange issue any case

1

same problem already did all, but issue not gone

my version WebStorm 2021.3.1

0

Please sign in to leave a comment.