NPM : Error: Cannot find module 'balanced-match'
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
add a comment |
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
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
add a comment |
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
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
node.js npm
asked Nov 23 '18 at 12:42
Kunjeti Aswarthmaiah GuptaKunjeti Aswarthmaiah Gupta
366
366
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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.
add a comment |
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.
add a comment |
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
.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Dec 1 '18 at 7:49
Kunjeti Aswarthmaiah GuptaKunjeti Aswarthmaiah Gupta
366
366
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 23 '18 at 13:34
kRiZkRiZ
326310
326310
add a comment |
add a comment |
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered Nov 23 '18 at 13:49
KrakenKraken
8831228
8831228
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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