Getting error : when set debugger in Nightwatchjs - node.js

Hi everyone I want to set debugger in my Nightwatchjs project But I got one error
my package.json
{
"name": "intro-to-nightwatchjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"debug": "node --inspect-brk node_modules/.bin/nightwatch",
"test": "nightwatch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chromedriver": "^80.0.1",
"eslint": "^6.8.0",
"minimist": "^1.2.5",
"nightwatch": "^1.3.4",
"optimist": "^0.6.1"
}
}

Related

Error: Cannot find module Please verify that the package.json has a valid "main" entry

i will delete the node modules file again reinstall npm i but my problem couldn't solve the problem
here's the code ok package.json
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.1.0",
"body-parser": "^1.20.1",
"cctx": "^1.0.1",
"dotenv": "^16.0.3",
"express": "npm:Express#^3.0.1",
"Express": "^3.0.1"
},
"devDependencies": {
"nodemon": "^2.0.20"
}
}

server is not starting on save - nodemon

I am working on a graphql project. I have installed nodemon globally but whenever I make any change I have to restart manually because for some reason nodemon is not working correctly. Following is my environment
Ubuntu
Nodejs 10.24.1
nodemon 2.0.15
and my Package.json file is following
{
"name": "graphql-basic",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon --exec babel-node src/index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"get-schema": "graphql get-schema -p prisma"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"graphql-cli": "^2.16.4",
"graphql-yoga": "^1.16.7",
"prisma-binding": "^2.1.1",
"uuid": "^3.3.2"
},
"devDependencies": {}
}

When typing yarn start in the terminal an error occurs stating /bin/sh: nodemon: command not found Command failed with exit code 127 comes up

My json package is below
{
"name": "node-rest-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.3",
"mongoose": "^6.2.3"
}
}
I have exhausted all solutions I have found as most of them point to me having start in my json package which I already do so,
Because nodemon module is not installed
either install manually by below command
npm i nodemon
or add nodemon in pakage.json
{
"name": "node-rest-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.3",
"mongoose": "^6.2.3",
}
"devDependencies": {
"nodemon" : "^2.0.15"
}
}
and after that npm install

nodemon cannot recognize mocha

I tried to run test automatically using nodemon instead of running them manually. I installed mocha and nodemonn on single time. This is how my package.json looks like:
{
"name": "Ti Ri Ho",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "nodemon --exec 'mocha -R min'"
},
"author": "",
"license": "ISC",
"dependencies": {
"mocha": "^5.2.0",
"mongoose": "^5.3.15",
"nodemon": "^1.18.7"
}
}
I change "scripts": {"test": "mocha" } to "scripts": {"test": "nodemon --exec 'mocha -R min'"}.What could be the possible reason?

heroku can't start nodejs app

my app works fine local. But when I upload it to github and try to start it with heroku, it says "application error". The build log doesn't show any errors but the app log shows this:
and I think I my port connection is right:
const config = {
port: process.env.PORT || 3000,
};
app.listen(config.port);
package.json:
{
"name": "labo4",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon ."
},
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.3",
"glob": "^7.1.2",
"jade": "^1.11.0",
"path": "^0.12.7"
}
}
package.json
{
"name": "labo4",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.3",
"glob": "^7.1.2",
"jade": "^1.11.0",
"path": "^0.12.7"
}
}
By default Heroku will search for a start in your package.json so edit it as above.

Resources