NPM : Error: Cannot find module 'balanced-match'





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







2















I just updated the node and npm using nvm. When I start the node server I am getting this error. I tried with different solutions. This type of questions already existed in stack overflow but none of these worked for me. So I tried with these things but no use.



1.Removed node modules and install node modules with npm install.

2.Updated babel-cli version.

3.downgraded node and nvm.

4.npm i balanced-match.

5.npm i -g balanced-match.

6.npm i balanced-match --save.



I am adding my package.json



{
"name": "******",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon express-server.js --exec babel-node",
"build": "babel ./ -d dist",
"serve": "node dist/index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel": "^6.23.0",
"bluebird": "^3.5.1",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"ejs": "^2.6.1",
"express": "^4.16.3",
"express-es6-template-engine": "^2.0.3",
"express-session": "^1.15.6",
"handlebars": "^4.0.11",
"helmet": "^3.13.0",
"html": "^1.0.0",
"instamojo-nodejs": "0.0.5",
"jsonwebtoken": "^8.2.2",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"mongoose": "^5.1.3",
"mongoose-unique-validator": "^2.0.1",
"multer": "^1.3.0",
"mysql": "^2.15.0",
"node-fetch": "^2.1.2",
"node-schedule": "^1.3.0",
"node-xlsx": "^0.12.1",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-google-oauth20": "^1.0.0",
"passport-local": "^1.0.0",
"request": "^2.88.0",
"request-ip": "^2.0.2",
"sanitize-html": "^1.18.2",
"utf8": "^3.0.0",
"validator": "^10.2.0",
"xlsx2json": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"nodemon": "^1.17.5"
}
}


In console it showing like this.
console error



I wasted 12 hours time to solve this problem only.










share|improve this question























  • Please remove the image and add the complete error stacktrace to your question.

    – common sense
    Nov 23 '18 at 12:46











  • Have you imported it in the file where you're using it? like this: const balanced = require('balanced-match');

    – SanSolo
    Nov 23 '18 at 12:49


















2















I just updated the node and npm using nvm. When I start the node server I am getting this error. I tried with different solutions. This type of questions already existed in stack overflow but none of these worked for me. So I tried with these things but no use.



1.Removed node modules and install node modules with npm install.

2.Updated babel-cli version.

3.downgraded node and nvm.

4.npm i balanced-match.

5.npm i -g balanced-match.

6.npm i balanced-match --save.



I am adding my package.json



{
"name": "******",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon express-server.js --exec babel-node",
"build": "babel ./ -d dist",
"serve": "node dist/index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel": "^6.23.0",
"bluebird": "^3.5.1",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"ejs": "^2.6.1",
"express": "^4.16.3",
"express-es6-template-engine": "^2.0.3",
"express-session": "^1.15.6",
"handlebars": "^4.0.11",
"helmet": "^3.13.0",
"html": "^1.0.0",
"instamojo-nodejs": "0.0.5",
"jsonwebtoken": "^8.2.2",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"mongoose": "^5.1.3",
"mongoose-unique-validator": "^2.0.1",
"multer": "^1.3.0",
"mysql": "^2.15.0",
"node-fetch": "^2.1.2",
"node-schedule": "^1.3.0",
"node-xlsx": "^0.12.1",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-google-oauth20": "^1.0.0",
"passport-local": "^1.0.0",
"request": "^2.88.0",
"request-ip": "^2.0.2",
"sanitize-html": "^1.18.2",
"utf8": "^3.0.0",
"validator": "^10.2.0",
"xlsx2json": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"nodemon": "^1.17.5"
}
}


In console it showing like this.
console error



I wasted 12 hours time to solve this problem only.










share|improve this question























  • Please remove the image and add the complete error stacktrace to your question.

    – common sense
    Nov 23 '18 at 12:46











  • Have you imported it in the file where you're using it? like this: const balanced = require('balanced-match');

    – SanSolo
    Nov 23 '18 at 12:49














2












2








2








I just updated the node and npm using nvm. When I start the node server I am getting this error. I tried with different solutions. This type of questions already existed in stack overflow but none of these worked for me. So I tried with these things but no use.



1.Removed node modules and install node modules with npm install.

2.Updated babel-cli version.

3.downgraded node and nvm.

4.npm i balanced-match.

5.npm i -g balanced-match.

6.npm i balanced-match --save.



I am adding my package.json



{
"name": "******",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon express-server.js --exec babel-node",
"build": "babel ./ -d dist",
"serve": "node dist/index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel": "^6.23.0",
"bluebird": "^3.5.1",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"ejs": "^2.6.1",
"express": "^4.16.3",
"express-es6-template-engine": "^2.0.3",
"express-session": "^1.15.6",
"handlebars": "^4.0.11",
"helmet": "^3.13.0",
"html": "^1.0.0",
"instamojo-nodejs": "0.0.5",
"jsonwebtoken": "^8.2.2",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"mongoose": "^5.1.3",
"mongoose-unique-validator": "^2.0.1",
"multer": "^1.3.0",
"mysql": "^2.15.0",
"node-fetch": "^2.1.2",
"node-schedule": "^1.3.0",
"node-xlsx": "^0.12.1",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-google-oauth20": "^1.0.0",
"passport-local": "^1.0.0",
"request": "^2.88.0",
"request-ip": "^2.0.2",
"sanitize-html": "^1.18.2",
"utf8": "^3.0.0",
"validator": "^10.2.0",
"xlsx2json": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"nodemon": "^1.17.5"
}
}


In console it showing like this.
console error



I wasted 12 hours time to solve this problem only.










share|improve this question














I just updated the node and npm using nvm. When I start the node server I am getting this error. I tried with different solutions. This type of questions already existed in stack overflow but none of these worked for me. So I tried with these things but no use.



1.Removed node modules and install node modules with npm install.

2.Updated babel-cli version.

3.downgraded node and nvm.

4.npm i balanced-match.

5.npm i -g balanced-match.

6.npm i balanced-match --save.



I am adding my package.json



{
"name": "******",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon express-server.js --exec babel-node",
"build": "babel ./ -d dist",
"serve": "node dist/index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel": "^6.23.0",
"bluebird": "^3.5.1",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"ejs": "^2.6.1",
"express": "^4.16.3",
"express-es6-template-engine": "^2.0.3",
"express-session": "^1.15.6",
"handlebars": "^4.0.11",
"helmet": "^3.13.0",
"html": "^1.0.0",
"instamojo-nodejs": "0.0.5",
"jsonwebtoken": "^8.2.2",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"mongoose": "^5.1.3",
"mongoose-unique-validator": "^2.0.1",
"multer": "^1.3.0",
"mysql": "^2.15.0",
"node-fetch": "^2.1.2",
"node-schedule": "^1.3.0",
"node-xlsx": "^0.12.1",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-google-oauth20": "^1.0.0",
"passport-local": "^1.0.0",
"request": "^2.88.0",
"request-ip": "^2.0.2",
"sanitize-html": "^1.18.2",
"utf8": "^3.0.0",
"validator": "^10.2.0",
"xlsx2json": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"nodemon": "^1.17.5"
}
}


In console it showing like this.
console error



I wasted 12 hours time to solve this problem only.







node.js npm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 12:42









Kunjeti Aswarthmaiah GuptaKunjeti Aswarthmaiah Gupta

416




416













  • Please remove the image and add the complete error stacktrace to your question.

    – common sense
    Nov 23 '18 at 12:46











  • Have you imported it in the file where you're using it? like this: const balanced = require('balanced-match');

    – SanSolo
    Nov 23 '18 at 12:49



















  • Please remove the image and add the complete error stacktrace to your question.

    – common sense
    Nov 23 '18 at 12:46











  • Have you imported it in the file where you're using it? like this: const balanced = require('balanced-match');

    – SanSolo
    Nov 23 '18 at 12:49

















Please remove the image and add the complete error stacktrace to your question.

– common sense
Nov 23 '18 at 12:46





Please remove the image and add the complete error stacktrace to your question.

– common sense
Nov 23 '18 at 12:46













Have you imported it in the file where you're using it? like this: const balanced = require('balanced-match');

– SanSolo
Nov 23 '18 at 12:49





Have you imported it in the file where you're using it? like this: const balanced = require('balanced-match');

– SanSolo
Nov 23 '18 at 12:49












3 Answers
3






active

oldest

votes


















1














I solved this problem by installing the balanced-match with npm install balanced-match in root folder. I don't know why it is taking root folder node modules. In console error it is clearly given path but I have not aware of it. If anyone explain why it is taking root node modules that would be helpful to me.






share|improve this answer































    0














    I did not see any node packages as balanced-match. Hence, it is giving the error. You can also manually add package in package.json and run npm install.






    share|improve this answer































      0














      If you ran this command: npm i balanced-match --save there would be an entry for it in your package.json file. Does your app require this module for production or is it a development tool? That will determine which flag you should pass to the install command. From the docs:




      -P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.



      -D, --save-dev: Package will appear in your devDependencies.



      -O, --save-optional: Package will appear in your optionalDependencies.



      --no-save: Prevents saving to dependencies.



      When using any of the above options to save dependencies to your
      package.json, there are two additional, optional flags:



      -E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm’s default semver range operator.



      -B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.




      The previous answer does have the most likely fix for your problem. You can either run the install command again with the correct flag for your use case (which will install it and update your package.json), or you can add it manually and run npm install again.



      When you install, are there any errors at all? If not, it should work. You can check for installed packages using npm ls (passing optional tags like '-g' will show you all globally installed modules, and you can modify the output by also passing a depth tag like such: --depth=0.






      share|improve this answer
























        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%2f53446932%2fnpm-error-cannot-find-module-balanced-match%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        I solved this problem by installing the balanced-match with npm install balanced-match in root folder. I don't know why it is taking root folder node modules. In console error it is clearly given path but I have not aware of it. If anyone explain why it is taking root node modules that would be helpful to me.






        share|improve this answer




























          1














          I solved this problem by installing the balanced-match with npm install balanced-match in root folder. I don't know why it is taking root folder node modules. In console error it is clearly given path but I have not aware of it. If anyone explain why it is taking root node modules that would be helpful to me.






          share|improve this answer


























            1












            1








            1







            I solved this problem by installing the balanced-match with npm install balanced-match in root folder. I don't know why it is taking root folder node modules. In console error it is clearly given path but I have not aware of it. If anyone explain why it is taking root node modules that would be helpful to me.






            share|improve this answer













            I solved this problem by installing the balanced-match with npm install balanced-match in root folder. I don't know why it is taking root folder node modules. In console error it is clearly given path but I have not aware of it. If anyone explain why it is taking root node modules that would be helpful to me.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 1 '18 at 7:49









            Kunjeti Aswarthmaiah GuptaKunjeti Aswarthmaiah Gupta

            416




            416

























                0














                I did not see any node packages as balanced-match. Hence, it is giving the error. You can also manually add package in package.json and run npm install.






                share|improve this answer




























                  0














                  I did not see any node packages as balanced-match. Hence, it is giving the error. You can also manually add package in package.json and run npm install.






                  share|improve this answer


























                    0












                    0








                    0







                    I did not see any node packages as balanced-match. Hence, it is giving the error. You can also manually add package in package.json and run npm install.






                    share|improve this answer













                    I did not see any node packages as balanced-match. Hence, it is giving the error. You can also manually add package in package.json and run npm install.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 23 '18 at 13:34









                    kRiZkRiZ

                    326311




                    326311























                        0














                        If you ran this command: npm i balanced-match --save there would be an entry for it in your package.json file. Does your app require this module for production or is it a development tool? That will determine which flag you should pass to the install command. From the docs:




                        -P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.



                        -D, --save-dev: Package will appear in your devDependencies.



                        -O, --save-optional: Package will appear in your optionalDependencies.



                        --no-save: Prevents saving to dependencies.



                        When using any of the above options to save dependencies to your
                        package.json, there are two additional, optional flags:



                        -E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm’s default semver range operator.



                        -B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.




                        The previous answer does have the most likely fix for your problem. You can either run the install command again with the correct flag for your use case (which will install it and update your package.json), or you can add it manually and run npm install again.



                        When you install, are there any errors at all? If not, it should work. You can check for installed packages using npm ls (passing optional tags like '-g' will show you all globally installed modules, and you can modify the output by also passing a depth tag like such: --depth=0.






                        share|improve this answer




























                          0














                          If you ran this command: npm i balanced-match --save there would be an entry for it in your package.json file. Does your app require this module for production or is it a development tool? That will determine which flag you should pass to the install command. From the docs:




                          -P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.



                          -D, --save-dev: Package will appear in your devDependencies.



                          -O, --save-optional: Package will appear in your optionalDependencies.



                          --no-save: Prevents saving to dependencies.



                          When using any of the above options to save dependencies to your
                          package.json, there are two additional, optional flags:



                          -E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm’s default semver range operator.



                          -B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.




                          The previous answer does have the most likely fix for your problem. You can either run the install command again with the correct flag for your use case (which will install it and update your package.json), or you can add it manually and run npm install again.



                          When you install, are there any errors at all? If not, it should work. You can check for installed packages using npm ls (passing optional tags like '-g' will show you all globally installed modules, and you can modify the output by also passing a depth tag like such: --depth=0.






                          share|improve this answer


























                            0












                            0








                            0







                            If you ran this command: npm i balanced-match --save there would be an entry for it in your package.json file. Does your app require this module for production or is it a development tool? That will determine which flag you should pass to the install command. From the docs:




                            -P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.



                            -D, --save-dev: Package will appear in your devDependencies.



                            -O, --save-optional: Package will appear in your optionalDependencies.



                            --no-save: Prevents saving to dependencies.



                            When using any of the above options to save dependencies to your
                            package.json, there are two additional, optional flags:



                            -E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm’s default semver range operator.



                            -B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.




                            The previous answer does have the most likely fix for your problem. You can either run the install command again with the correct flag for your use case (which will install it and update your package.json), or you can add it manually and run npm install again.



                            When you install, are there any errors at all? If not, it should work. You can check for installed packages using npm ls (passing optional tags like '-g' will show you all globally installed modules, and you can modify the output by also passing a depth tag like such: --depth=0.






                            share|improve this answer













                            If you ran this command: npm i balanced-match --save there would be an entry for it in your package.json file. Does your app require this module for production or is it a development tool? That will determine which flag you should pass to the install command. From the docs:




                            -P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.



                            -D, --save-dev: Package will appear in your devDependencies.



                            -O, --save-optional: Package will appear in your optionalDependencies.



                            --no-save: Prevents saving to dependencies.



                            When using any of the above options to save dependencies to your
                            package.json, there are two additional, optional flags:



                            -E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm’s default semver range operator.



                            -B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.




                            The previous answer does have the most likely fix for your problem. You can either run the install command again with the correct flag for your use case (which will install it and update your package.json), or you can add it manually and run npm install again.



                            When you install, are there any errors at all? If not, it should work. You can check for installed packages using npm ls (passing optional tags like '-g' will show you all globally installed modules, and you can modify the output by also passing a depth tag like such: --depth=0.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 23 '18 at 13:49









                            KrakenKraken

                            9401228




                            9401228






























                                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.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446932%2fnpm-error-cannot-find-module-balanced-match%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







                                Popular posts from this blog

                                "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                Alcedinidae

                                Origin of the phrase “under your belt”?