-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positives reported when using yarn instead of npm to install modules #34
Comments
From @banyudu on March 22, 2017 3:24 I have this issue, too. Message
was generated by the extension 'npm'. |
From @ttraenkler on March 24, 2017 15:1 Visual Studio Code 1.10.2 on latest macOS Sierra 10.12.3 |
From @sandy081 on March 27, 2017 6:51 These problems are generated from the extension |
@tyrsius @ttraenkler @banyudu this warning is correct and indicates that you have a module in your node_modules folder that isn't listed in the package.json. This can happen when it was installed without the Why is this bad? When the folder is shared through an SCM system and the node_modules are not checked in, then your team mate cannot just run The fix is to add these modules as @tyrsius the warning will no appear when you follow your steps and do an npm install in a fresh folder. |
From @ttraenkler on March 28, 2017 15:27 @egamma I am using "yarn add" to add dependencies, not "npm install", which "adds" the --save parameter implicitly. |
From @tyrsius on March 28, 2017 15:41 The install process is too long to capture in a gif. However, as you can see from this screenshot of the terminal, the only thing in this folder before I ran |
From @banyudu on March 29, 2017 1:44 @egamma Yes, it works with npm. But if someone use yarn or cnpm instead of npm, things are different.
These directories(or symbolic links) will trigger the extraneous warn. |
I followed the steps and didn't get the warning. Not clear what the difference between yours and my setup is. This warning actually comes from |
/tmp/test $ rm -r * /tmp/test $ Environment: |
You should be able to reproduce this issue with the popular create-react-app tool from Facebook that bootstraps a preconfigured standard React app. I cannot tell if this is an issue related to Visual Studio Code, NPM, or this tool, but from the other comments it seems it pops up elsewhere as well.
The steps I used to produce the project
|
@ttraenkler thanks for the additional info. It shows that the warning shown by the extension is consistent with the analysis from
Not clear yet why All I can offer for now is to disable warnings all together using the setting |
Thanks |
@egamma Thanks for tracking this down to npm. Was surprised to see the author of a book on my shelf answer npm questions 👍. I really like Visual Studio Code and its smooth out of the box experience. The only thing I am really missing from Webstorm is a visual GIT merge tool (microsoft/vscode#5770). |
😃 @ttraenkler glad you like VS Code Improving the support for merging changes in on our roadmap, there is an extension makes merging simpler. |
I can reproduce the issue when using yarn instead of npm to install the modules. It doesn't make sense to use Therefore I'm thinking to disable the checking when an install is done using yarn. The fact that yarn is used for installation can be detected by the existance of the yarn.lock file. |
Alright, thanks - at least this way no more false errors are clogging the problem log. (Of course it would be nice to have some checking for package.json but there may be more pressing issues.) |
Alternatively, to keep the functionality, you could use |
cnpm has this issue, too. But it doesn't have a file like yarn.lock. |
I've looked into this but |
Thinking about this some more this extension should support that the user can configure which node package manager they want to use. |
Another option is check dependencies in modules: If some module looks like 'extraneous', check whether it is a dependency of another module which is listed in package.json. But that may be a bit complex. |
@banyudu I don't think the extension should try to mimic the package resolution from yarn or cnpm to detect extraneous modules. In particular for yarn extraneous modules are typically not a problem since yarn add/remove also updates the package.json. So this source of error is gone. |
@egamma I agree with you. |
Published as 0.1.9 |
From @tyrsius on March 1, 2017 23:19
Steps to Reproduce:
package.json
filenpm install
dependencies
These packages are not dependencies of the package, and this error should not show.
Copied from original issue: microsoft/vscode#21666
The text was updated successfully, but these errors were encountered: