Angular boot error npm ERR! code ELIFECYCLE - json

I have this problem when I want boot Angular project
tried install plugins
{
"name": "portal-app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.config.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.0",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/router": "^5.0.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "^1.6.3",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^5.0.0",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
You have to be inside an angular-cli project in order to use the
serve command.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! portal-app#0.0.0
start: ng serve --proxy-config proxy.config.json npm ERR! Exit
status 1 npm ERR! npm ERR! Failed at the portal-app#0.0.0 start
script. npm ERR! This is probably not a problem with npm. There is
likely additional logging output above. npm WARN Local package.json
exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\User\AppData\Roaming\npm-cache_logs\2019-04-24T06_32_19_277Z-debug.log
Process finished with exit code 1

Your error is clear and meaningful : you need to be inside your project to run your command. You'll maybe need to use the change directory command to place your command prompt at the right location before launching your npm scripts.
So :
cd /path/to/projectDirectory
npm start
Should do the trick.

in my case I got this type of error when running ng test --karma-config=karma.conf.js --code-coverage, and the cause of problem were console.log statements in the code

Related

Error schema validation failed with the following errors: Data path " " must not have additional properties(SourceMap)

I have just upgraded the application from Angular 8 version to Angular 15 version.
And, when i given the command 'npm start' am getting below error, and please find the below screenshot for reference.
error schema validation failed with the following errors: Data path " " must not have additional properties(SourceMap)
enter image description here
I upgraded the application and try to run the application by giving the 'npm start' command.
Package.json
"name": "manual-override-tool"
"version":
"0.0.0"
"scripts": (
"ng": "ng",
"start": "ng serve --ssl-true"
г
"build": "ng build -c-dev"
"prod": "ng build --prod",
"build:preproduction": "ng build -c-preproduction",
"dev": "ng build -c-dev", mbuild-prod": "ng build
--configuration-production",
"preproduction": "ng build --configuration preproduction"
"staging": "ng build -c-staging"
"test™: "ng test",
"test-coverage": "ng test ntest-coverage-w": "ng test
-_watch=false --code-coverage"
--watch-true--code-coverage"
"lint": "ng lint" mege": "ng eze"
"sonar": "sonar-scanner"
1, "private": true,
"dependencies": (
"(angular/animations":
"~15.1.2",
"#angular/cdk": "~15.1.2",
"#angular/common": "~15.1.2",
"#angular/compiler": "~15.1.2",
"#angular/core": "^15.1.2",
"#angular/forms": "~15.1.2",
"#angular/material": "^15.1.2"
"#angular/platform-browser": "~15.1.2",
"#angular/platform-browser-dynamic":"~15.1.2",
"#angular/router": "-15.1.2"
"#narx/effects": "^15.2.1",
"#ngrx/store": #^15.2.1"
"#ngrx/store-devtools": "^15.2.1",
"#syncfusion/ej2-angular-buttons": "^17.2.47",
"#syncfusion/ej2-angular-dropdowns": "^17.3.16",
"#syncfusion/ej2-angular-grids": "^17.2.51",
"#syncfusion/ej2-angular-inputs": "^17.3.17",
"#syncfusion/ej2-angular-navigations":"^17.2.49",
"core-js: "^2.5.4",
"file-saver": "^2.0.2",
"microsoft-adal-angular6": "^1.3.0",
"rxjs":"~6.5.3",
"rxjs-compat": "^6.6.7",
"tslib":"^1.9.0",
"zone.js": "~0.12.0"
},
"devDependencies":
"#angular-devkit/build-angular": "^15.1.3",
"#angular/cli": "^15.1.3",
"#angular/compiler-cli":"^15.1.2",
"Gangular/language-service": "~15.1.2",
"#types/jasmine": "-2.8.8"
"#types/jasminewd2": "~2.0.3"
"#types/node": "-8.9.4",
"ajv":"^7.2.4",
"codelyzer":"^5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^6.4.1"
"karma-chrome-launcher":"~2.2.0"
"karma-coverage-istanbul-reporter": "-2.0.1",
"karma-jasmine":"~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor":"~7.0.0",
"sonar-scanner": "^3.1.0"
"ts-node": "~7.0.01
"tslint":"~5.11.01
"typescript":"^4.9.54
}
}

Build Issue With Angular Project while updating Angular 7 to 13

I wanted to upgrade the Angular version in my project from 7 to 13, but I am facing some issues. Below you can see my package in Json format:
{
"name": "comresi-angular",
"version": "0.0.0",
"scripts": {
"start": "ng serve",
"start:local": "ng serve --base-href=/",
"build:prod": "ng build --configuration production",
"build:dev": "ng build ----configuration dev",
"build:local": "npm run build:dev && npm run copy_tomcat",
"copy_tomcat": "xcopy \"../webapp/resources\\*\" \"%CATALINA_HOME%\\webapps\\erlcr\\resources\" /s /i /y > nul"
},
"private": true,
"dependencies": {
"#angular/animations": "~13.1.0",
"#angular/cdk": "~13.1.0",
"#angular/common": "~13.1.0",
"#angular/compiler": "~13.1.0",
"#angular/core": "~13.1.0",
"#angular/forms": "~13.1.0",
"#angular/http": "^7.0.0",
"#angular/material": "~13.1.0",
"#angular/platform-browser": "~13.1.0",
"#angular/platform-browser-dynamic": "~13.1.0",
"#angular/service-worker": "~13.1.0",
"#angular/router": "~13.1.0",
"#ngx-translate/core": "11.0.1",
"#ngx-translate/http-loader": "4.0.0",
"#types/bingmaps": "0.0.1",
"#types/jquery": "^3.3.22",
"#types/npm": "^2.0.29",
"#types/slickgrid": "^2.1.26",
"ag-grid-angular": "^19.0.0",
"ag-grid-community": "^19.0.0",
"angular-maps": "^6.0.1",
"angular-slickgrid": "^2.1.8",
"bingmaps": "^2.0.3",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"dhtmlx-gantt": "file:gantt_7.1.8_evaluation",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"jqwidgets-scripts": "^6.1.0",
"moment": "^2.19.1",
"rxjs": "~7.4.0",
"rxjs-compat": "^7.4.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "13.1.2",
"#angular/cli": "~13.1.0",
"#angular/compiler-cli": "~13.1.0",
"#angular/language-service": "~13.1.0",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~4.4.3",
"rxjs": "~7.4.0"
}
}
but I am getting the following error while running npm install:
While resolving: comresi-angular#0.0.0
Found: #angular-devkit/build-angular#0.10.7
node_modules/#angular-devkit/build-angular
dev #angular-devkit/build-angular#"13.1.2" from the root project
Could not resolve dependency:
dev #angular-devkit/build-angular#"13.1.2" from the root project
Conflicting peer dependency: #angular/core#13.1.1
node_modules/#angular/core
peer #angular/core#"13.1.1" from #angular/service-worker#13.1.1
node_modules/#angular/service-worker
#angular/service-worker#"~13.1.0" from the root project
peerOptional #angular/service-worker#"^13.0.0 || ^13.1.0-next" from #angular-devkit/build-angular#13.1.2
node_modules/#angular-devkit/build-angular
dev #angular-devkit/build-angular#"13.1.2" from the root project
Could you help me to understand why I am getting that error?
If you use the official angular update website and you put your angular versions From 7.0 To 13.0 you will get the following warning:
so obviously you need to go through all the major versions until v13.0
As per my experience with project. It is better to build a simple product with latest version (or version which you want). and add a component from your existing application gradually.

NativeScript Could not find module "#nativescript/schematics"

When I make tns generate component movies, I get terminal log:
Could not find module "#nativescript/schematics".
I tried solutions from https://github.com/NativeScript/nativescript-schematics/issues/130 , but next terminal message is:
Error: Invalid rule result: Instance of class Promise.
package.json:
"dependencies": {
"#angular/animations": "~9.1.0",
"#angular/common": "~9.1.0",
"#angular/compiler": "~9.1.0",
"#angular/core": "~9.1.0",
"#angular/forms": "~9.1.0",
"#angular/platform-browser": "~9.1.0",
"#angular/platform-browser-dynamic": "~9.1.0",
"#angular/router": "~9.1.0",
"#nativescript/angular": "~9.0.0",
"#nativescript/theme": "~2.3.0",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.5.0",
"tns-core-modules": "~6.5.0",
"zone.js": "~0.10.3"
"devDependencies": {
"#angular/cli": "^10.0.4",
"#angular/compiler-cli": "~9.1.0",
"#ngtools/webpack": "~9.1.0",
"nativescript-dev-webpack": "~1.5.0",
"tns-platform-declarations": "~6.5.0",
"typescript": "~3.8.3"
ng --version
#angular-devkit/architect 0.1000.4
#angular-devkit/core 9.1.12
#angular-devkit/schematics 10.0.4
#angular/cli 10.0.4
#ngtools/webpack 9.1.12
#schematics/angular 10.0.4
#schematics/update 0.1000.4
rxjs 6.6.0
typescript 3.8.3
webpack 4.27.1
Try installing nativescript/schematics. I can't see it in your package.json.
npm i -g #nativescript/schematics
You have Angular/cli 10 so it schould work.
I don't see #nativescript/schematics in the package.json. try to have install #nativescript/schematics
npm install --save-dev #nativescript/schematic
See more:
https://github.com/NativeScript/nativescript-schematics/issues/130#issuecomment-524841101

Angular ng serve is not hosting site on localhost

When I run ng serve on my CLI, I get the following output:
Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/
But when I open http://localhost:4200/ in my browser so there is nothing.
Any advice on how to solve this issue?
Here's my package.json
{
"name": "eastlaw",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^6.1.0",
"#angular/common": "^6.1.0",
"#angular/compiler": "^6.1.0",
"#angular/core": "^6.1.0",
"#angular/forms": "^6.1.0",
"#angular/http": "^6.1.0",
"#angular/platform-browser": "^6.1.0",
"#angular/platform-browser-dynamic": "^6.1.0",
"#angular/router": "^6.1.0",
"core-js": "^2.5.4",
"rxjs": "6.0.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.7.0",
"#angular/cli": "~6.1.5",
"#angular/compiler-cli": "^6.1.0",
"#angular/language-service": "^6.1.0",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}
To debug the issue try the following :
ng serve -o
Check the default port mentioned in config file with the key baseURL
check with ng build command (if webpack is getting generated)
ng serve --port 8080 --host 0.0.0.0 --disableHostCheck true
if possible try to upload browser console image
Consider these things :
By opening server via ng serve, it can only be opened on
browsers on that device.
If you want to serve it for the devices on your network you should use ng serve --
host <your_device_ip>
Note: Device IP is the IP Address of the device you are serving from.
First, verify your machine IP Address.
On Windows, type ipconfig in Prompt (copy IPv4). On Mac, type ifconfig |grep inet in Terminal (copy inet).
In my case, this is 192.168.0.10. Next, type the command ng serve --host 192.168.0.10 Ok, your app on air for all devices on the same network.
Now only http://192.168.0.10:4200/ will work, localhost not more.

Trying to run npm run dev "No entries found."

When I'm running "npm run dev" it gives me this error:
Server running at http://localhost:1234
🚨 No entries found.
at Bundler.bundle (/Users/igoraccebas/node_modules/parcel-bundler/src/Bundler.js:275:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: parcel react/src/react.html
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Here is my package.json file
{
"name": "adopt-me",
"version": "1.0.0",
"description": "An app to teach you to write React",
"main": "react/src/App.js",
"scripts": {
"test": "",
"format": "prettier --write \"src/**/*.{js,jsx}\"",
"lint": "eslint \"src/**/*.{js,jsx}\" --quiet",
"dev": "parcel react/src/react.html"
},
"repository": {
"type": "git",
"url": "git+https://github.com/btholt/complete-intro-to-react-v4.git"
},
"author": "Brian Holt <btholt#gmail.com>",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/btholt/complete-intro-to-react-v4/issues"
},
"homepage": "https://github.com/btholt/complete-intro-to-react-v4#readme",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"eslint": "^5.3.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.10.0",
"parcel-bundler": "^1.12.3",
"prettier": "^1.14.2"
},
"dependencies": {
"#reach/router": "^1.1.1",
"petfinder-client": "^0.0.3",
"react": "^16.4.2",
"react-dom": "^16.4.2"
}
}
Instead of this
"dev": "parcel react/src/react.html"
do this
"dev": "parcel src/react.html"
You should use main directory like that: frontend/index.html