Redundant Dependencies In node_modules folder










0














I have a private npm module being installed from github private repo. That module has a dependency on "axios" module. So in package.json i have added it under dependency.



package.json of private module




"name": "xxx",
"version": "1.0.0",
"description": "xxxx",
"main": "index.js",
"scripts":
"test": "echo "Error: no test specified" && exit 1"
,
"repository":
"type": "git",
"url": "git+https://github.com/xxxx/yyyy.git"
,
"keywords": [
"xxxx"
],
"author": "xxxx",
"license": "ISC",
"bugs":
"url": "https://github.com/xxx"
,
"homepage": "https://github.com/xxxxx#readme",
"dependencies":
"axios": "latest"




I am using "axios" in my "index.js" also, so "axios" is listed as dependency in my root level "package.json"



package.json at root level



{
"name": "my code",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies":
"axios": "^0.18.0",
"xxx": "git+ssh://github.com/xxxx/yyyy.git",
"scripts":
"test": "echo "Error: no test specified" && exit 1"
,
"author": "",
"license": "ISC"



Overall "axios" is listed as dependency in my project in 2 places.
When i execute npm install. "axios" is getting installed in two places.



  1. node_modules in root level

  2. node_modules present in the directory of xxx

This is how my project structure after executing npm install




Project
|
+-- index.js
|
+-- package.json
|
+-- node_modules
| |
| +-- axios
| |
| +-- xxx
| | |
| | +-- index.js
| | |
| | +-- package.json
| | |
| | +-- node_modules
| | | |
| | | +-- axios // How to avoid axios getting installed here again and make
it reuse the one in root level node_modules directory










share|improve this question




























    0














    I have a private npm module being installed from github private repo. That module has a dependency on "axios" module. So in package.json i have added it under dependency.



    package.json of private module




    "name": "xxx",
    "version": "1.0.0",
    "description": "xxxx",
    "main": "index.js",
    "scripts":
    "test": "echo "Error: no test specified" && exit 1"
    ,
    "repository":
    "type": "git",
    "url": "git+https://github.com/xxxx/yyyy.git"
    ,
    "keywords": [
    "xxxx"
    ],
    "author": "xxxx",
    "license": "ISC",
    "bugs":
    "url": "https://github.com/xxx"
    ,
    "homepage": "https://github.com/xxxxx#readme",
    "dependencies":
    "axios": "latest"




    I am using "axios" in my "index.js" also, so "axios" is listed as dependency in my root level "package.json"



    package.json at root level



    {
    "name": "my code",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "dependencies":
    "axios": "^0.18.0",
    "xxx": "git+ssh://github.com/xxxx/yyyy.git",
    "scripts":
    "test": "echo "Error: no test specified" && exit 1"
    ,
    "author": "",
    "license": "ISC"



    Overall "axios" is listed as dependency in my project in 2 places.
    When i execute npm install. "axios" is getting installed in two places.



    1. node_modules in root level

    2. node_modules present in the directory of xxx

    This is how my project structure after executing npm install




    Project
    |
    +-- index.js
    |
    +-- package.json
    |
    +-- node_modules
    | |
    | +-- axios
    | |
    | +-- xxx
    | | |
    | | +-- index.js
    | | |
    | | +-- package.json
    | | |
    | | +-- node_modules
    | | | |
    | | | +-- axios // How to avoid axios getting installed here again and make
    it reuse the one in root level node_modules directory










    share|improve this question


























      0












      0








      0







      I have a private npm module being installed from github private repo. That module has a dependency on "axios" module. So in package.json i have added it under dependency.



      package.json of private module




      "name": "xxx",
      "version": "1.0.0",
      "description": "xxxx",
      "main": "index.js",
      "scripts":
      "test": "echo "Error: no test specified" && exit 1"
      ,
      "repository":
      "type": "git",
      "url": "git+https://github.com/xxxx/yyyy.git"
      ,
      "keywords": [
      "xxxx"
      ],
      "author": "xxxx",
      "license": "ISC",
      "bugs":
      "url": "https://github.com/xxx"
      ,
      "homepage": "https://github.com/xxxxx#readme",
      "dependencies":
      "axios": "latest"




      I am using "axios" in my "index.js" also, so "axios" is listed as dependency in my root level "package.json"



      package.json at root level



      {
      "name": "my code",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "dependencies":
      "axios": "^0.18.0",
      "xxx": "git+ssh://github.com/xxxx/yyyy.git",
      "scripts":
      "test": "echo "Error: no test specified" && exit 1"
      ,
      "author": "",
      "license": "ISC"



      Overall "axios" is listed as dependency in my project in 2 places.
      When i execute npm install. "axios" is getting installed in two places.



      1. node_modules in root level

      2. node_modules present in the directory of xxx

      This is how my project structure after executing npm install




      Project
      |
      +-- index.js
      |
      +-- package.json
      |
      +-- node_modules
      | |
      | +-- axios
      | |
      | +-- xxx
      | | |
      | | +-- index.js
      | | |
      | | +-- package.json
      | | |
      | | +-- node_modules
      | | | |
      | | | +-- axios // How to avoid axios getting installed here again and make
      it reuse the one in root level node_modules directory










      share|improve this question















      I have a private npm module being installed from github private repo. That module has a dependency on "axios" module. So in package.json i have added it under dependency.



      package.json of private module




      "name": "xxx",
      "version": "1.0.0",
      "description": "xxxx",
      "main": "index.js",
      "scripts":
      "test": "echo "Error: no test specified" && exit 1"
      ,
      "repository":
      "type": "git",
      "url": "git+https://github.com/xxxx/yyyy.git"
      ,
      "keywords": [
      "xxxx"
      ],
      "author": "xxxx",
      "license": "ISC",
      "bugs":
      "url": "https://github.com/xxx"
      ,
      "homepage": "https://github.com/xxxxx#readme",
      "dependencies":
      "axios": "latest"




      I am using "axios" in my "index.js" also, so "axios" is listed as dependency in my root level "package.json"



      package.json at root level



      {
      "name": "my code",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "dependencies":
      "axios": "^0.18.0",
      "xxx": "git+ssh://github.com/xxxx/yyyy.git",
      "scripts":
      "test": "echo "Error: no test specified" && exit 1"
      ,
      "author": "",
      "license": "ISC"



      Overall "axios" is listed as dependency in my project in 2 places.
      When i execute npm install. "axios" is getting installed in two places.



      1. node_modules in root level

      2. node_modules present in the directory of xxx

      This is how my project structure after executing npm install




      Project
      |
      +-- index.js
      |
      +-- package.json
      |
      +-- node_modules
      | |
      | +-- axios
      | |
      | +-- xxx
      | | |
      | | +-- index.js
      | | |
      | | +-- package.json
      | | |
      | | +-- node_modules
      | | | |
      | | | +-- axios // How to avoid axios getting installed here again and make
      it reuse the one in root level node_modules directory







      javascript node.js github npm node-modules






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 at 21:24

























      asked Nov 12 at 14:15









      Ajay

      184




      184



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264011%2fredundant-dependencies-in-node-modules-folder%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264011%2fredundant-dependencies-in-node-modules-folder%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Museum of Modern and Contemporary Art of Trento and Rovereto

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully