Posts

Ionic ios build fails, error archive not found : Error code 65 for command: xcodebuild with args

If you are working on ionic app, and you are trying to create iOS build then usually we use the following command: ionic cordova build ios OR ionic cordova build ios --device --prod --release while creating build if you get following error: ✖ cordova build ios - failed! [ ERROR ] An error occurred while running cordova build ios (exit code 1):          error: archive not found at path '/Users/work/MyApp/platforms/ios/MyAppp.xcarchive'         ** EXPORT FAILED **         CordovaError: Promise rejected with non-error: 'Error code 65 for command: xcodebuild with args:   Then You have to use the following command: ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0" if this won't work then you can update and or create a build.json file. { "ios" : { "release" : { ..., "buildFlag" : [ ...

Mastering in Javascript | How do JavaScript closures work?

Image
How do JavaScript closures work? When I started learning some advanced concepts of JavaScript that time I got to know about closures but when tried to understand it but it was like leave me alone. Then I did some research on it but still, I was getting only theoretical concepts of closures. So I thought might be I am not alone who don't understand closures so I tried to explain it with examples. What is Closure in JavaScript? A closure is a function having access to the parent scope, even after the parent function has closed.    A closure is one way of supporting first-class functions; it is an expression that can reference variables within its scope (when it was first declared), be assigned to a variable, be passed as an argument to a function, or be returned as a function result. this is the terminology used to explain the closure but I know how hard it is to understand, so let's go by examples. Example of Closures in JavaScript function ...

MongoDB remove unique constraint

Image
MongoDB Remove the unique constraint: Src: https://en.wikipedia.org/wiki/MongoDB Today, I'm working on a RESTful API Using Node.js With Express and Mongoose example, and I ran into a problem with the MongoDB Schema: POST : { username: 'vikaskad' , email: 'testmail@test.com' , name : 'Vikas Kad' } { [ MongoError : E11000 duplicate key error index : ecomm_database . users . $email_1 dup key : { : "testmail@test.com" }] name : 'MongoError' , err : 'E11000 duplicate key error index: ecomm_database.users.$email_1 dup key: { : "testmail@test.com " }' , and my schema is as follows: var Product = new Schema ({ username : { type : String , required : true }, email : { type : String ,unique:true, required : true }, name : { type : String }, createdAt : { type : Date , default : Date . now } }); but after some database inser...

PM2 cheat sheet | PM2 commands | PM2 tutorial

Image
PM2 PM2 (Process Manager): PM2 is a process manager for Node.JS apps when I want to keep node app to run in the background mostly use pm2 for it. I wanted to understand all its commands and its use so I went through its document, and write down some useful commands, then I thought let's share this as cheatsheet with all of you might be this can be useful for all of you. PM2 Cheatsheet: Start-Process: pm2 start server.js --name crudapp It will start server.js app with name as crud app. pm2 start server.js --no-daemon It will run pm2 daemon in the foreground if it doesn’t exist already. pm2 start server.js --no-autorestart It will not auto restart if the server stops. pm2 start server.js --no-vizion It will skip the versioning control mode. pm2 start server.js -i 0 It will start maximum processes with LB depending on available CPUs. pm2 start all It will start all existing process and restart if already ru...