Loopback CLI created PersistedModel properites not working when model json updated - express

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 Verification#1.0.0~start: unsafe-perm in lifecycle true
npm verb lifecycle Verification#1.0.0~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 Verification#1.0.0~start: CWD: /Users/xxx/Desktop/Samples/Verification
npm info lifecycle Verification#1.0.0~start: Failed to exec start script
npm verb stack Error: Verification#1.0.0 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 Verification#1.0.0
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! Verification#1.0.0 start: `node .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Verification#1.0.0 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

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.

Related

NPM INSTALL failed on react-native project : "unable to resolve dependency tree for react & react-dom"

I'm going to start working on a react-native project with another developer, but i've worked on another project before this one and it ran on an android emulator without errors.
I cloned the project from https://github.com/ismail-benlaredj/ld-vetrinalive-reactnative and ran npm install which resulted in this error :
PS G:\Workspaces\React Native\ld-vetrinalive-reactnative> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: nativetestapp#0.0.0
npm ERR! Found: react#18.0.0
npm ERR! node_modules/react
npm ERR! react#"18.0.0" from the root project
npm ERR! peer react#"*" from native-base#3.4.25
npm ERR! node_modules/native-base
npm ERR! native-base#"^3.4.25" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-dom#18.2.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"*" from native-base#3.4.25
npm ERR! node_modules/native-base
npm ERR! native-base#"^3.4.25" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\DEV-ABDOU\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DEV-ABDOU\AppData\Local\npm-cache\_logs\2022-12-17T21_35_51_753Z-debug.log
and this is the eresolve-report.txt :
# npm resolution error report
2022-12-17T21:35:51.742Z
While resolving: nativetestapp#0.0.0
Found: react#18.0.0
node_modules/react
react#"18.0.0" from the root project
peer react#"*" from native-base#3.4.25
node_modules/native-base
native-base#"^3.4.25" from the root project
Could not resolve dependency:
peer react#"^18.2.0" from react-dom#18.2.0
node_modules/react-dom
peer react-dom#"*" from native-base#3.4.25
node_modules/native-base
native-base#"^3.4.25" from the root project
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.
Raw JSON explanation object:
{
"code": "ERESOLVE",
"current": {
"name": "react",
"version": "18.0.0",
"whileInstalling": {
"name": "nativetestapp",
"version": "0.0.0",
"path": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
},
"location": "node_modules/react",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "react",
"spec": "18.0.0",
"from": {
"location": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
}
},
{
"type": "peer",
"name": "react",
"spec": "*",
"from": {
"name": "native-base",
"version": "3.4.25",
"whileInstalling": {
"name": "nativetestapp",
"version": "0.0.0",
"path": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
},
"location": "node_modules/native-base",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "native-base",
"spec": "^3.4.25",
"from": {
"location": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
}
}
]
}
}
]
},
"currentEdge": {
"type": "prod",
"name": "react",
"spec": "18.0.0",
"from": {
"location": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
}
},
"edge": {
"type": "peer",
"name": "react",
"spec": "^18.2.0",
"error": "INVALID",
"from": {
"name": "react-dom",
"version": "18.2.0",
"whileInstalling": {
"name": "nativetestapp",
"version": "0.0.0",
"path": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
},
"location": "node_modules/react-dom",
"isWorkspace": false,
"dependents": [
{
"type": "peer",
"name": "react-dom",
"spec": "*",
"from": {
"name": "native-base",
"version": "3.4.25",
"whileInstalling": {
"name": "nativetestapp",
"version": "0.0.0",
"path": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
},
"location": "node_modules/native-base",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "native-base",
"spec": "^3.4.25",
"from": {
"location": "G:\\Workspaces\\React Native\\ld-vetrinalive-reactnative"
}
}
]
}
}
]
}
},
"strictPeerDeps": false,
"force": false
}
I dont know if i should include the lengthy npm log or not ( let me know ).
The problem :
i dont know how to interpret the error messages ( resolve the peer dependencies )
the console suggests to use the flags : --force, or --legacy-peer-deps at my own risk, i'm hesitant about doing that because it says
... to accept an incorrect (and potentially broken) dependency resolution.
and it's the reason i'm asking for help here.
Similar questions on SOF :
React Native app's npm install fails due to conflicting versions of react and react-dom
What i've tried so far :
Most answers i saw online suggested that i update my global react-native-cli but according to the docs here they ask you to uninstall it.
Also some answers pointed to some environment variables not being set properly, this isnt the case for me, since my other projects work fine.
Try this.
npm cache verify
rm -rf node_modules
rm package-lock.json
npm i
This will clean the npm cache and rebuild the package-lock.json
and node_modules
If it doesnt work, let me know and i will clone the repo and take a look.

Gitlab package registry NPM Publish showing Error - npm ERR! need auth This command requires you to be logged in to

My .npmrc file contains
#componentlibrary:registry = http://IP/api/v4/projects/342/packages/npm/
'//http://IP/api/v4/projects/342/packages/npm/:_authToken'="AUTH_TOKEN"
My package.json contains
"name": "#componentlibrary/storybookProject",
"version": "1.0.0",
"description": "",
"main": "dist/index.main.js",
"module": "dist/index.module.js",
"files": [
"dist"
],
"publishConfig": {
"#componentlibrary:registry": "http://IP/api/v4/projects/342/packages/npm/"
},
.........
.........
while running npm publish the following error is showing
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to http://IP/api/v4/projects/342/packages/npm/
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user1\AppData\Local\npm-cache\_logs\2022-07-30T07_19_55_191Z-debug-0.log

Cannot find module 'live-server' (locally installed)

I have been trying to run babel and live-server locally , however when calling for 'npm run build' or 'npm run serve' I get the following error:
> boilerplate#1.0.0 serve C:\Users\sasaa\OneDrive\Documents\HTMl&CSS\j-14-05-globals\boilerplate
> live-server public
'CSS\j-14-05-globals\boilerplate\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module 'C:\Users\sasaa\OneDrive\Documents\live-server\live-server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! boilerplate#1.0.0 serve: `live-server public`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the boilerplate#1.0.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\sasaa\AppData\Roaming\npm-cache\_logs\2020-01-05T00_21_18_216Z-debug.log
This is the package-json:
{
"name": "boilerplate",
"version": "1.0.0",
"description": "",
"main": "input.js",
"scripts": {
"serve": "live-server public",
"build": "babel src/index.js --out-file public/scripts/bundle.js --presets env --watch"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"live-server": "^1.2.1"
}
}
I am using Windows 10 with Git Bash
npm version 6.13.4
node v13.5.0
Any suggestions how to solve this issue?

Cannot read property 'run' of undefined (awesome-typescript-loader)

I'm attempting to update our angular 5 application to angular 6, and am running into a build issue currently with awesome-typescript loader.
The full error message is
C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5
compiler.hooks.run.tapAsync('at-loader', function(params, callback) {
^
TypeError: Cannot read property 'run' of undefined
at CheckerPlugin.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5:18)
at Compiler.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\tapable\lib\Tapable.js:375:16)
at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:33:19)
at options.map.options (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:55)
at Array.map (<anonymous>)
at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:40)
at processOptions (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:335:15)
at yargs.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:397:2)
at Object.Yargs.self.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\node_modules\yargs\yargs.js:533:18)
at Object.<anonymous> (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:152:7)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Angular.Web.App#1.0.0-rc3 build:webpack: `webpack --progress --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Angular.Web.App#1.0.0-rc3 build:webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_890Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Angular.Web.App#1.0.0-rc3 build:dev: `npm run build:vendor && npm run build:webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Angular.Web.App#1.0.0-rc3 build:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_936Z-debug.log
it is required, as our webpack is pulling in its CheckerPlugin
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
module.exports = (env) => {
// Configuration in common to both client-side and server-side bundles
const isDevBuild = !(env && env.prod);
const sharedConfig = {
stats: { modules: false },
context: __dirname,
resolve: { extensions: [ '.js', '.ts' ] },
output: {
filename: '[name].js',
publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
},
module: {
rules: [
{ test: /\.ts$/, use: isDevBuild ? ['angular2-template-loader', 'angular2-router-loader'] : '#ngtools/webpack' },
{ test: /\.html$/, use: 'html-loader?minimize=false' },
{ test: /\.css$/, use: [ 'to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize' ] },
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' },
...sharedModuleRules
]
},
plugins: [new CheckerPlugin()]
};
currenlty using awesome-typescript-loader v. 5.0.0

Project won't start after installation

Installed create-react-native-app and used it to create my application.
Everything worked fine until i've installed react-navigation like in tutorial npm install --save react-navigation
My project won't even start. I haven't made any changes in it. I just installed this package.
package.json
{
"name": "EliteEl",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.10.0",
"jest-expo": "25.0.0",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "0.52.0",
"react-navigation": "^1.0.0-beta.27"
}
}
Error log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#5.5.1
3 info using node#v9.2.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle EliteEl#0.1.0~prestart: EliteEl#0.1.0
6 info lifecycle EliteEl#0.1.0~start: EliteEl#0.1.0
7 verbose lifecycle EliteEl#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle EliteEl#0.1.0~start: PATH: C:\Program
Files\nodejs\node_modules\npm\bin\node-gyp-bin;E:\xampp\htdocs\lessons\REACT\EliteEl\node_modules\.bin;E:\Soft\Embarcadero\Studio\19.0\bin;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl;E:\Soft\Embarcadero\Studio\19.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\Win64;E:\Soft\cuda\soft\bin;E:\Soft\cuda\soft\libnvvp;C:\ProgramData\Oracle\Java\javapath;E:\Soft\Anaconda3;E:\Soft\Anaconda3\Library\mingw-w64\bin;E:\Soft\Anaconda3\Library\usr\bin;E:\Soft\Anaconda3\Library\bin;E:\Soft\Anaconda3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;E:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files\PuTTY\;C:\Go\bin;C:\Program Files (x86)\Yarn\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_152\bin;C:\Program Files\Git\cmd;C:\Users\ykemer.SPA\AppData\Roaming\Composer\vendor\bin;C:\Users\ykemer.SPA\AppData\Roaming\npm;C:\Users\ykemer.SPA\AppData\Local\Yarn\bin
9 verbose lifecycle EliteEl#0.1.0~start: CWD: E:\xampp\htdocs\lessons\REACT\EliteEl
10 silly lifecycle EliteEl#0.1.0~start: Args: [ '/d /s /c', 'react-native-scripts start' ]
11 silly lifecycle EliteEl#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle EliteEl#0.1.0~start: Failed to exec start script
13 verbose stack Error: EliteEl#0.1.0 start: `react-native-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack at EventEmitter.emit (events.js:159:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:159:13)
13 verbose stack at maybeClose (internal/child_process.js:943:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid EliteEl#0.1.0
15 verbose cwd E:\xampp\htdocs\lessons\REACT\EliteEl
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v9.2.0
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error EliteEl#0.1.0 start: `react-native-scripts start`
22 error Exit status 1
23 error Failed at the EliteEl#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Error in console
Error: React native is not installed. Please run `npm install` in your project directory.
16:36:47: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
at C:\xdl\src\Project.js:1291:11
at Generator.next (<anonymous>)
at step (C:\Users\ykemer.SPA\AppData\Roaming\npm\node_modules\react-native-scripts\node_modules\xdl\build\Project.js:1679:191)
at C:\Users\ykemer.SPA\AppData\Roaming\npm\node_modules\react-native-scripts\node_modules\xdl\build\Project.js:1679:361
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! EliteEl#0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the EliteEl#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ykemer.SPA\AppData\Roaming\npm-cache\_logs\2018-01-24T12_36_47_683Z-debug.log
I don't know why, but it doesn't accept globally installed package.
So i had to run npm install and then everything was good