Skip to content
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

Undeclared dependency shows problem/warning for extraneous module #21666

Closed
kyeotic opened this issue Mar 1, 2017 · 12 comments
Closed

Undeclared dependency shows problem/warning for extraneous module #21666

kyeotic opened this issue Mar 1, 2017 · 12 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@kyeotic
Copy link

kyeotic commented Mar 1, 2017

  • VSCode Version: Version 1.10.0 (1.10.0)
  • OS Version: macOS Sierre 10.12 (16A323)

Steps to Reproduce:

  1. Create an empty project with the following package.json file
{
  "name": "vscode-bug",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "engine-handlebars": "^0.8.0",
    "express": "^4.14.0",
    "newrelic": "^1.36.2",
    "node-uuid": "^1.4.7"
  },
  "devDependencies": {
    "autoprefixer-stylus": "^0.11.0",
    "babel-core": "^6.3.21",
    "babel-eslint": "^7.0.0",
    "babel-loader": "^6.2.0",
    "babel-plugin-transform-runtime": "^6.15.0",
    "babel-plugin-webpack-alias": "^2.1.1",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-stage-0": "^6.3.13",
    "babel-tape-runner": "^2.0.1",
    "blue-tape": "^1.0.0",
    "chokidar-cli": "^1.2.0",
    "deep-extend": "^0.4.1",
    "immutable": "^3.8.1",
    "json-loader": "^0.5.4",
    "localforage": "^1.4.3",
    "npm-run-all": "^4.0.1",
    "qs": "^6.3.0",
    "raw-loader": "^0.5.1",
    "react": "^15.3.2",
    "react-addons-test-utils": "^15.3.2",
    "react-document-title": "^2.0.2",
    "react-dom": "^15.3.2",
    "react-hot-loader": "^3.0.0-beta.6",
    "react-markdown": "^2.4.2",
    "react-redux": "^4.4.5",
    "react-router": "^2.8.1",
    "react-router-redux": "^4.0.6",
    "redbox-react": "^1.3.2",
    "redux": "^3.6.0",
    "redux-thunk": "^2.1.0",
    "skin-deep": "^0.16.0",
    "snazzy": "^5.0.0",
    "source-map-loader": "^0.1.5",
    "standard": "^8.4.0",
    "stylus": "^0.54.5",
    "tap-spec": "^4.1.1",
    "url-join": "^1.1.0",
    "webpack": "^1.11.0",
    "webpack-dev-server": "^1.10.1"
  },
  "author": "",
  "license": "ISC"
}
  1. run npm install
  2. You will see the following problems listed for dependencies

[npm] Module 'https-proxy-agent' is extraneous
[npm] Module 'node-pre-gyp' is extraneous
[npm] Module 'readable-stream' is extraneous

These packages are not dependencies of the package, and this error should not show.

@sandy081
Copy link
Member

sandy081 commented Mar 2, 2017

@tyrsius Do you have any extensions that generate these problems?

@sandy081 sandy081 added the info-needed Issue requires more information from poster label Mar 2, 2017
@banyudu
Copy link

banyudu commented Mar 22, 2017

I have this issue, too.

Message

[npm] Module 'https-proxy-agent' is extraneous

was generated by the extension 'npm'.

@ttraenkler
Copy link

Visual Studio Code 1.10.2 on latest macOS Sierra 10.12.3
warning for "dependencies" in package.json: 'Module 'node-pre-gyp' is extraneous'
Here a list of the extensions installed:
bildschirmfoto 2017-03-24 um 15 56 09
bildschirmfoto 2017-03-24 um 15 56 20

@sandy081
Copy link
Member

These problems are generated from the extension npm. Please file issue against that extension.

@sandy081
Copy link
Member

@tyrsius Ca you please provide the screenshot of the problems you are seeing in the problems panel?

@egamma
Copy link
Member

egamma commented Mar 28, 2017

@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 --save or --savedev options.

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 npm install to have the same modules installed as you have.

The fix is to add these modules as devDependencies in your package.json file.

@tyrsius the warning will no appear when you follow your steps and do an npm install in a fresh folder.

@kyeotic
Copy link
Author

kyeotic commented Mar 28, 2017

@egamma If I follow the steps I posted in my initial post, in a new folder with a fresh npm install, I get this warning. I am sorry, but this warning is not correct.

@ttraenkler
Copy link

@egamma I am using "yarn add" to add dependencies, not "npm install", which "adds" the --save parameter implicitly.

@kyeotic
Copy link
Author

kyeotic commented Mar 28, 2017

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 yarn was the package.json file, no node_modules folder. After installing, you can see the problems for extraneous packages.

vs code bug

@banyudu
Copy link

banyudu commented Mar 29, 2017

@egamma Yes, it works with npm. But if someone use yarn or cnpm instead of npm, things are different.

npm install --save-dev eslint should create only one directory named 'eslint' under node_modules, while yarn add eslint and cnpm install --save-dev eslint will create lots of directories(or symbolic links) under node_modules.

These directories(or symbolic links) will trigger the extraneous warn.

@egamma egamma assigned egamma and unassigned sandy081 Mar 29, 2017
@egamma
Copy link
Member

egamma commented Mar 29, 2017

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 npm and is derived from the output of npm ls --depth 0 --json. Can you run this command from the command line in the root of the workspace and include the output.

@egamma
Copy link
Member

egamma commented Mar 29, 2017

This issue was moved to microsoft/vscode-npm-scripts#34

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants