Vishnu
Vishnu

Reputation: 2243

Loopback CLI created PersistedModel properites not working when model json updated

I've created a model using below command line tool in mac terminal and created model name with PersistedModel.

lb model

I've got respective json and js file for model and json structure looks as follows.

 {
 "name": "otp",
 "base": "PersistedModel",
 "idInjection": true,
 "options": {
   "validateUpsert": true
 },
"properties": {
   "otpnumber": {
   "type": "string",
   "required": true
 },
 "friends": {
  "type": "string",
  "required": true
  }
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}

these were generated from command line/terminal.Now I need to add few properties to this model and I edited this model json as follows

 {
 "name": "otp",
 "base": "PersistedModel",
 "idInjection": true,
 "options": {
   "validateUpsert": true
 },
"properties": {
   "otpnumber": {
   "type": "string",
   "required": true
 },
 "friends": {
  "type": "string",
  "required": true
  },
 "firstName": {
  "type": "string",
  "required": true
  },
  "city": {
  "type": "string",
  "required": true
  }
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}

After editing json file I restarted my localhost server and I found following error in terminal.

events.js:183
  throw er; // Unhandled 'error' event
  ^

Error: listen EADDRINUSE 0.0.0.0:3000
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at doListen (net.js:1501:7)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:678:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm verb lifecycle [email protected]~start: unsafe-perm in lifecycle true 
npm verb lifecycle [email protected]~start: PATH: 
/usr/local/lib/node_modules/npm/bin/node-gyp bin:/Users/xxx/Desktop/Samples/Verification/node_modules/.bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
npm verb lifecycle [email protected]~start: CWD: /Users/xxx/Desktop/Samples/Verification
npm info lifecycle [email protected]~start: Failed to exec start script
npm verb stack Error: [email protected] start: `node .`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> 
(/usr/local/lib/node_modules/npm/node_modules/npm-
lifecycle/index.js:280:16)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at EventEmitter.emit (events.js:214:7)
npm verb stack     at ChildProcess.<anonymous>         (/usr/local/lib/node_modules/npm/node_modules/npm-    lifecycle/lib/spawn.js:55:14)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at ChildProcess.emit (events.js:214:7)
npm verb stack     at maybeClose (internal/child_process.js:925:16)
npm verb stack     at Process.ChildProcess._handle.onexit     (internal/child_process.js:209:5)
npm verb pkgid [email protected]
npm verb cwd /Users/xxx/Desktop/Samples/Verification
npm verb Darwin 17.0.0
npm verb argv "/usr/local/Cellar/node/8.9.0/bin/node"     "/usr/local/bin/npm" "start" "-verbose"
npm verb node v8.9.0
npm verb npm  v5.5.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely     additional logging output above.
npm verb exit [ 1, true ]

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xxx/.npm/_logs/2017-11-01T12_14_39_706Z-debug.log

Upvotes: 0

Views: 347

Answers (1)

Jackson Vaughan
Jackson Vaughan

Reputation: 662

That Error: listen EADDRINUSE 0.0.0.0:3000 means that the port 3000 is in use. Try this solution to close it: How do I close an open port from the terminal on the Mac?

Once you've closed the port, you should be able to start up the application again.

Upvotes: 2

Related Questions