Nodemon detects changes, says it is restarting but doesn't actually restart - node.js

It was working before but it stopped. If I crash the express app in the app.js file, nodemon will restart at first, but once the app.listen() is executed it won't restart. I tried to isolate every element on the app.js file but the behavior continues. I also added some package recently and I deleted them to see if they caused the behavior but it remains.
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.2",
"compression": "^1.7.1",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.4.3",
"cookie-session": "^2.0.0-beta.3",
"debug": "^3.1.0",
"ejs": "^2.5.7",
"express": "^4.16.2",
"express-session": "^1.15.6",
"express-validator": "^4.3.0",
"google-finance": "^0.1.10",
"gulp": "^3.9.1",
"mongoose": "^4.13.7",
"morgan": "^1.9.0",
"nodemon": "^1.14.11",
"passport": "^0.4.0",
"passport-facebook": "^2.1.1",
"passport-google-oauth20": "^1.0.0",
"passport-local": "^1.0.0",
"range": "0.0.3",
"round-to": "^2.0.0",
"serve-favicon": "^2.4.5",
"underscore": "^1.8.3"
}
}

Are you sure that you are using nodemon, because the start command should be:
"start": "nodemon app"

Related

Not able to install project dependencies NodeJS

I am trying to install dependency in a project but getting this error. I already upgraded all dependencies and versions of npm but that's not working for me.
Package.json:
{
"name": "task",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.1.0",
"body-parser": "^1.19.0",
"connect-mongo": "^3.2.0",
"ejs": "^3.1.6",
"express": "^4.18.1",
"express-fileupload": "^1.4.0",
"express-flash": "^0.0.2",
"express-session": "^1.17.3",
"lodash": "^4.17.21",
"mongodb": "^4.9.1",
"mongoose": "^6.0.5",
"multer": "^1.4.3",
"node": "^16.6.1",
"nodemailer": "^6.7.0",
"nodemon": "^2.0.13",
"open": "^8.4.0",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"simplebar": "^5.3.5"
}
}

how can i fix this issue 'babel-node' is not recognized as an internal or external command, operable program or batch file.?

I'm working on node.js project. I have created this project by use Babel which was running fine in previous using node system . i have updated node.js version in my system, after that I'm getting error of Bebel-node. Any one can help me how can i solve this issue??b I have installed all bebal.js module.
I'm using code in bebel.rc
{
"plugins": [
"#babel/plugin-transform-runtime"
],
"presets": [
"#babel/env"
],
"ignore": [
"node_modules",
"src/public"
]
}
this is my updated package.json ....
{
"name": "backend-buluckart-hashing.company",
"version": "0.1.0",
"description": "groffers-nepal",
"main": "index.js",
"scripts": {
"start": "nodemon src/index.js --exec babel-node --presets #babel/env",
"build": "babel src -d dist --source-maps inline --copy-files",
"serve": "node dist/index.js",
"sequelize": "sequelize"
},
"keywords": [],
"author": "Ashutosh singh",
"license": "ISC",
"homepage": "",
"nodemonConfig": {
"ignore": [
"src/public/*"
]
},
"devDependencies": {
"#babel/cli": "^7.17.6",
"#babel/core": "^7.17.5",
"#babel/node": "^7.16.8",
"#babel/plugin-transform-runtime": "^7.17.0",
"#babel/preset-env": "^7.16.11",
"nodemon": "^2.0.15"
},
"dependencies": {
"#babel/runtime": "^7.17.2",
"aws-sdk": "^2.700.0",
"babel-upgrade": "^1.0.1",
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.18.3",
"cookie-parser": "^1.4.3",
"cors": "^2.8.5",
"dateformat": "^3.0.3",
"dotenv": "^8.0.0",
"event-stream": "^4.0.1",
"express": "^4.16.3",
"express-handlebars": "^6.0.2",
"express-sanitizer": "^1.0.5",
"express-session": "^1.15.6",
"helmet": "^3.15.1",
"joi": "^14.3.0",
"joi-date-extensions": "^1.2.0",
"jsonwebtoken": "^8.3.0",
"kue": "^0.11.1",
"mailparser": "^3.4.0",
"moment": "^2.24.0",
"morgan": "^1.9.0",
"multer": "^1.4.1",
"multer-s3": "^2.9.0",
"mysql": "^2.16.0",
"mysql2": "^1.6.4",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"qs": "^6.10.3",
"radis": "^2.0.0",
"razorpay": "^2.0.6",
"react-bootstrap": "^2.1.2",
"read-excel-file": "^5.2.26",
"request": "^2.88.0",
"rotating-file-stream": "^1.4.1",
"sequelize": "^5.21.13",
"sequelize-cli": "^6.4.1",
"speakeasy": "^2.0.0",
"stack-trace": "0.0.10",
"twilio": "^3.72.0"
}
}
"start": "nodemon --exec npx babel-node src/index.js",

Cannot deploy to heroku

Can someone help me regarding this problem. I can run this code by typing npm start but can I run it by any other option like nodemon src/server.js since I want to deploy it to heroku. here is my packag.json
{
"name": "quickstartnodejs",
"version": "1.0.0",
"description": "a quick start for node.js project",
"main": "server.js",
"scripts": {
"start": "nodemon --exec babel-node src/server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/haryphamhust/quickStartNodeJSProject.git"
},
"keywords": [
"nodejs",
"mysql"
],
"author": "Hary Pham",
"license": "ISC",
"bugs": {
"url": "https://github.com/haryphamhust/quickStartNodeJSProject/issues"
},
"engines": {
"node": "14.15.1"
},
"homepage": "https://github.com/haryphamhust/quickStartNodeJSProject#readme",
"dependencies": {
"absorb": "^1.0.1",
"body-parser": "^1.19.0",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.4.5",
"dotenv": "^8.2.0",
"ejs": "^3.1.2",
"express": "^4.17.1",
"express-fileupload": "^1.2.1",
"express-session": "^1.17.2",
"express-validator": "^6.12.0",
"generate-password": "^1.6.0",
"multer": "^1.4.2",
"mysql": "^2.18.1",
"nodemailer": "^6.6.2",
"passport": "^0.4.1",
"passport-local": "^1.0.0"
},
"devDependencies": {
"#babel/core": "^7.14.8",
"#babel/node": "^7.14.7",
"#babel/preset-env": "^7.14.8",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"nodemon": "^2.0.3"
}
}
does anyone have an idea
You could try adding a Procfile. Create a new file in your app root directory and call it Procfile (no dots or extentions). Populate it with the following:
web: node ./src/server.js
Check out the docs here:
https://devcenter.heroku.com/articles/getting-started-with-nodejs

Unable to install graphql-koa library in my project

Whenever I'm trying to install koa yarn add apollo-server-koa graphql, I'm getting this error:
Couldn't find package "#koa/cors#^2.2.1" required by "apollo-server-koa" on the "npm" registry.
I tried npm instead of yarn and I got the same error.
Here is my package.json file:
"name": "onlineshopbe",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"bcrypt": "^5.0.0",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-handlebars": "^5.1.0",
"file-url": "^3.0.0",
"graphql": "^15.3.0",
"graphql-relay": "^0.6.0",
"graphql-sequelize": "^9.4.0",
"jsonwebtoken": "^8.5.1",
"koa": "^2.13.0",
"multer": "^1.4.2",
"nodemon": "^2.0.4",
"pg": "^8.3.0",
"sequelize": "^6.3.4"
},
"devDependencies": {},
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js"
},
"author": "",
"license": "ISC"
}
Any suggestions please?

Browser Console error: Cannot find module 'react-dom/lib/ReactPerf' from 'react/lib/ReactAddonsDOMDependencies.js'

This started today after saving the react-addons-css-transition-group npm package as a dependency.
I then went down a rabbit hole of updating, adding & removing various dependencies as well as making sure all the react-related dependencies share the same versioning. I think I'm back to where I was before adding the react-addons-css-transition-group dependency, aside from updates, but I'm still getting this error and I can't find anything online relating to it specifically.
package.json if that helps:
{
"name": "",
"version": "0.1.0",
"author": "",
"description": "",
"license": "MIT",
"repository": {
"type": "git",
"url": ""
},
"main": "server.js",
"scripts": {
"lint": "eslint --ext .js,.jsx --ignore-pattern public",
"start": "brunch watch --server",
"knex": "knex",
"heroku-postbuild": "brunch build --production; knex migrate:latest",
"nf": "nf start"
},
"dependencies": {
"auto-reload-brunch": "^2.7.1",
"axios": "^0.14.0",
"babel-brunch": "^6.0.5",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"bcrypt": "^0.8.7",
"bcrypt-as-promised": "^1.1.0",
"body-parser": "^1.15.2",
"boom": "^4.0.0",
"brunch": "^2.9.1",
"clean-css-brunch": "^2.0.0",
"cookie-parser": "^1.4.3",
"dotenv": "^2.0.0",
"express": "^4.14.0",
"express-validation": "^1.0.1",
"humps": "^1.1.0",
"javascript-brunch": "^2.0.0",
"joi": "^9.0.4",
"jsonwebtoken": "^7.1.9",
"knex": "^0.12.0",
"material-ui": "^0.16.3",
"morgan": "^1.7.0",
"multer": "1.1.0",
"pg": "^6.1.0",
"react": "^15.4.1",
"react-cookie": "^0.4.8",
"react-dom": "^15.4.1",
"react-router": "^2.8.0",
"react-tap-event-plugin": "^2.0.0",
"sass-brunch": "^2.7.0",
"weak-key": "^1.0.0",
"xml2js": "^0.4.17"
},
"devDependencies": {
"eslint": "^3.2.2",
"eslint-config-ryansobol": "^8.0.0",
"foreman": "^2.0.0"
},
"engines": {
"node": "7.2.0"
}
}
I was able to resolve this issue by deleting the node-modules folder and re-importing all dependencies.
My dependencies and devDependencies sections look like that after the re-import:
"dependencies": {
"lodash": "^4.17.2",
"material-ui": "^0.16.5",
"react": "^15.4.1",
"react-addons-perf": "^15.4.1",
"react-addons-test-utils": "^15.4.1",
"react-dom": "^15.4.1",
"react-tap-event-plugin": "^2.0.1"
},
"devDependencies": {
"auto-reload-brunch": "^2.0.0",
"babel-brunch": "~6.0.0",
"babel-preset-es2015": "~6.9.0",
"babel-preset-react": "~6.11.1",
"brunch": "^2.4.0",
"clean-css-brunch": "^2.0.0",
"css-brunch": "^2.0.0",
"javascript-brunch": "^2.0.0",
"uglify-js-brunch": "^2.0.0"
}
This is caused by a Brunch bug.
We added a workaround in React 15.4.2 but can’t guarantee it won’t break again.

Resources