I am having a weird problem, suddenly the nodemon stopped showing console log.
I am using npm run dev command to run the nodeJS app and my package.json looks like below,
{
"name": "loginform",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon app.js"
},
"dependencies": {
"async": "^2.1.4",
"body-parser": "^1.15.2",
"body-parser-xml": "^1.1.0",
"cassandra-driver": "^3.1.6",
"connect-flash": "^0.1.1",
"ejs": "^2.0.6",
"es6-template-strings": "^2.0.1",
"express": "^4.14.0",
"express-rate-limit": "^2.6.0",
"express-session": "^1.10.1",
"log-buffer": "0.0.3",
"mongodb": "^2.2.25",
"mongoose": "^4.7.0",
"nodemailer": "^0.7.1",
"passport": "^0.2.1",
"passport-facebook": "^1.0.3",
"passport-local": "^1.0.0",
"passport-twitter": "^1.0.2",
"qs": "^6.3.0",
"sweetalert2": "^6.5.5",
"trim": "0.0.1",
"url-pattern": "^1.0.3",
"uuid": "^3.0.1",
"xml2js": "^0.4.17"
},
"devDependencies": {
"nodemon": "^1.11.0"
}
}
I was working but suddenly stopped working, I am able to figure out why, though I had installed pm2 in between but uninstalled, is this the cause that might have broken the logging?
Update
This is how my console looks, no log at all.
Can anyone help with a solution?
Thanks.
You had a typo. I am sure you run this via npm run dev.
Try removing your node_modules folder, and re run npm install
Related
I have certain node modules that i want to update. If i run npm outdated i see a list of modules and when i run npm update not all modules are updated.
I still see some in the list when i run npm outdated
my node version is v12.16.2
i see the below list when executing npm outdated
Below are the contents of my package.json
{
"name": "exporter",
"version": "1.0.0",
"description": "api endpoint",
"main": "server.js",
"dependencies": {
"#sentry/node": "5.30",
"abort-controller": "^3.0.0",
"archiver": "^5.2.0",
"aws-sdk": "^2.825.0",
"body-parser": "^1.19.0",
"bull": "^3.20.0",
"bull-board": "^0.9.0",
"config": "^3.3.3",
"cors": "^2.8.5",
"csv": "^5.3.2",
"dotenv": "^8.2.0",
"exceljs": "^4.2.0",
"express": "^4.17.1",
"express-basic-auth": "^1.2.0",
"express-rate-limit": "^5.2.3",
"fs": "0.0.1-security",
"generic-pool": "^3.7.1",
"helmet": "^4.3.1",
"jimp": "^0.16.1",
"JSONStream": "^1.3.5",
"jsonwebtoken": "^8.5.1",
"morgan": "^1.10.0",
"node-fetch": "^2.6.1",
"nodemailer": "^6.5.0",
"pg": "^8.6.0",
"pg-query-stream": "^4.1.0",
"pm2": "^4.5.1",
"puppeteer": "^5.5.0",
"rate-limit-redis": "^2.0.0",
"twitter": "^1.7.1",
"underscore": "^1.12.0",
"uuid": "^8.3.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "/usr/local/bin/pm2 restart all --update-env"
},
"author": "",
"license": "ISC"
}
How can i update all the below modules, specifically pm2 and puppeteer. Thanks.
npm update respects semver constraints.
This command will update all the packages listed to the latest version (specified by the tag config), respecting the semver constraints of both your package and its dependencies (if they also require the same package).
According to the package.json, the constraints are
#sentry/node: exact version
bull-board, dotenv, pm2, puppeteer: caret range
The packages are up-to-date according to these constraints.
To get the latest versions, you can install packages with the #latest tag.
Note that these are major version updates - things can break.
I got project from my client to update that project with some points. But I'm facing problem to run this project.
I install npm and all required node modules downloaded based on package.json information.
{
"name": "acelle-builder",
"version": "1.0.0",
"description": "",
"private": true,
"type" : "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#types/ace": "0.0.42",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.6.0",
"file-loader": "^4.1.0",
"html-loader": "^0.5.5",
"mini-css-extract-plugin": "^0.8.0",
"node-sass": "^4.14.1",
"raw-loader": "^3.1.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"svg-url-loader": "^3.0.0",
"to-string-loader": "^1.1.5",
"url-loader": "^2.1.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"ace-builds": "^1.4.12",
"bootstrap": "^4.5.2",
"jquery": "^3.5.1",
"js-beautify": "^1.13.0",
"popper.js": "^1.16.1"
}
}
there are some codes of importing html files like
import controls from './controls.html';
import widgets from './widgets.html';
but when I run this project using node command I'm getting error with unknown file .html extension.
How can I solve this?
Node.js can only import JS modules.
If you want to use syntax which involves importing other kinds of things then you need to use an appropriate tool. The dependencies in the package.json file include WebPack. Use that.
There is even a script (named build) listed that will run it.
npm run build
You can't import from an html file. You are trying to import from ./controls.html and ./widgets.html. You have to import from js files. Maybe you meant "./controls.html" and "./widgets.js".
can somebody know how to update version of electron because when i run mycode in npm start is working but when i run my code in mocha test is have a lot of error electron
the left one is run with : npm start
the right one isrun with : test mocha
and the problem is i think the electron is different version
can somebody explained what happened :)
this is my package json
this is my packagejson
"dependencies": {
"#babel/runtime": "^7.12.13",
"#ugenu.io/electrolizer": "^1.0.3",
"axios": "^0.21.1",
"chai": "^4.3.4",
"electron": "^9.4.3",
"express": "^4.17.1",
"jquery": "^3.5.1",
"mocha": "^8.3.2",
"nightmare": "^3.0.2",
"nightmare-upload": "^0.1.1"
}
Try to change "electron": "^9.4.3" to like "electron": "^12.0.0",
UPDATE It seems the problem is I can't update/edit my post. Every time I create a new post, then it enter dead loop. Please help me T-T
Recently I started a program using keystoneJS as my CMS.
Everything goes fine but this Post problem.
I have found if I install keystone-demo via yo keystone(using the KeystoneJS generator made with Yeoman) then publishing post can work, but if I install keystone manually, the problem comes...
In Google Inspect Console, there is a error-
"TypeError: undefined is not an object (evaluating 'refList.expandColumns')"
I guess it is the keystone version problem.
This is my package.json file
{
"name": "keystone-demo",
"version": "1.0.1",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/JedWatson/keystone-demo.git"
},
"dependencies": {
"keystone": "https://github.com/keystonejs/keystone.git",
"async": "^1.5.0",
"lodash": "^3.10.1",
"csv": "^0.4.6",
"gulp": "^3.9.1",
"gulp-less": "^3.1.0",
"gulp-shell": "^0.5.2",
"gulp-watch": "^4.3.5",
"pug": "^2.0.0-alpha6"
},
"scripts": {
"start": "node keystone.js"
}
}
And this is the package.json file in that can work normally version
{
"name": "keystone",
"version": "0.0.0",
"private": true,
"dependencies": {
"keystone": "^0.3.16",
"async": "^1.5.0",
"underscore": "^1.8.3",
"node-sass": "^3.3.2",
"node-sass-middleware": "^0.9.7",
"dotenv": "^1.1.0"
},
"devDependencies": {
"gulp": "^3.7.0",
"gulp-jshint": "^1.9.0",
"jshint-stylish": "^0.1.3",
"gulp-shell": "^0.5.0",
"gulp-watch": "^4.3.5",
"gulp-sass": "^2.0.4"
},
"engines": {
"node": ">=0.10.22",
"npm": ">=1.3.14"
},
"scripts": {
"start": "node keystone.js"
},
"main": "keystone.js"
}
You're loading the latest keystone version from github, which is not always stable. This is probably the reason for the error you're seeing.
I recommend using the latest version published to npm (0.3.22 at time of writing) instead.
Update the first line in your dependencies to this, and it will work:
"keystone": "^0.3.22",
To add keystone to a new project you can also type npm install --save keystone
I want to run the meanjs existing project that I got from my friend in my mac pc but when I run the 'grunt' command then following error is getting:
grunt-cli: The grunt command line interface. (v0.1.13)
Fatal error: Unable to find local grunt.
after searching google I have used these two command below:
sudo npm install grunt --save-dev
npm install
but following errors are getting:
Loading "gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'load-grunt-tasks'
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
[NB: but grunt is working for the newly created meanjs project on my local mac but not for this old project from my friend]
Updated - I have the the package.json file here:
{
"name": "meanjsapp",
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js",
"version": "0.0.1",
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},
"dependencies": {
"apn": "^1.7.4",
"async": "~0.9.0",
"body-parser": "~1.9.0",
"bower": "~1.3.8",
"chalk": "~0.5",
"compression": "~1.2.0",
"connect-flash": "~0.1.1",
"connect-mongo": "~0.4.1",
"consolidate": "~0.10.0",
"cookie-parser": "~1.3.2",
"cron": "^1.0.9",
"express": "~4.10.1",
"express-session": "~1.9.1",
"forever": "~0.11.0",
"glob": "~4.0.5",
"grunt-cli": "~0.1.13",
"helmet": "~0.5.0",
"jsonwebtoken": "^5.0.2",
"jwt-simple": "^0.3.0",
"lodash": "~2.4.1",
"method-override": "~2.3.0",
"mongoose": "~3.8.8",
"morgan": "~1.4.1",
"multer": "^0.1.8",
"nodemailer": "~1.3.0",
"passport": "~0.2.0",
"passport-facebook": "~1.0.2",
"passport-github": "~0.1.5",
"passport-google-oauth": "~0.1.5",
"passport-linkedin": "~0.1.3",
"passport-local": "~1.0.0",
"passport-twitter": "~1.0.2",
"swig": "~1.4.1"
},
"devDependencies": {
"supertest": "~0.14.0",
"should": "~4.1.0",
"grunt-env": "~0.4.1",
"grunt-node-inspector": "~0.1.3",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-csslint": "^0.3.1",
"grunt-ng-annotate": "~0.4.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-cssmin": "~0.10.0",
"grunt-nodemon": "~0.3.0",
"grunt-concurrent": "~1.0.0",
"grunt-mocha-test": "~0.12.1",
"grunt-karma": "~0.9.0",
"load-grunt-tasks": "~1.0.0",
"karma": "~0.12.0",
"karma-jasmine": "~0.2.1",
"karma-coverage": "~0.2.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-phantomjs-launcher": "~0.1.2"
}
}
Can anybody help me?
A Node.js project, if used with npm, must come with a package.json file.
The package.json ( https://docs.npmjs.com/files/package.json ) file contains all the infos about the project, even the dependencies (which are added with the --save).
So if your friend did everything right you have just to run npm install and should install all the dependencies. If there's no package.json file or if there are no dependencies written on it, you have to install them manually.
grunt has many modules to work, and one of those is called load-grunt-tasks so you should run again npm install load-grunt-tasks --save-dev of course this is just if you do not have the dependencies in the file.