NativeScript Could not find module "#nativescript/schematics" - json

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

Related

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.

GET call, Invalid JSON error when Updating to Angular 9

I am working to update my app to Angular 9 CLI and all of my NPM packages to the latest versions. But when I try to make a GET call to load the data on page load the page breaks with a 400 error returned from the server. This endpoint call breaks:
#Effect()
getAllData$ = this.action$.pipe(
ofType<DataAction>(DATA_ACTION_TYPES.GET_ALL_DATA),
switchMap(() => {
return this.dataservice.getAllData().pipe(
map(data => {
const payload = new DataPayload();
payload.data = data;
return new GottenAllDataAction(data);
})
);
})
);
public getAllData(): Observable<any[]> {
// code hits the dataEndpoint
return this.httpClient
.get(this.dataEndpoint)
.pipe(map(response => plainToClass(DataV2, response as Object[], { groups: ['get'] })));
}
In the network tab I get a 400 error with this response:
Here is the start of my 400 console error from the GET call:
Here is my package.json:
"dependencies": {
"#angular/animations": "9.1.6",
"#angular/cdk": "9.2.3",
"#angular/common": "9.1.6",
"#angular/compiler": "9.1.6",
"#angular/core": "9.1.6",
"#angular/flex-layout": "~9.0.0-beta.29",
"#angular/forms": "9.1.6",
"#angular/material": "9.2.3",
"#angular/platform-browser": "9.1.6",
"#angular/platform-browser-dynamic": "9.1.6",
"#angular/router": "9.1.6",
"#auth0/angular-jwt": "^4.0.0",
"#ngrx/effects": "~9.1.2",
"#ngrx/router-store": "~9.1.2",
"#ngrx/store": "~9.1.2",
"#ngrx/store-devtools": "~9.1.2",
"#nrwl/nx": "6.3.1",
"class-transformer": "0.1.9",
"classlist.js": "^1.1.20150312",
"core-js": "~3.6.5",
"es6-shim": "^0.35.5",
"file-saver": "^2.0.2",
"hammerjs": "2.0.8",
"highcharts": "~8.1.0",
"moment": "~2.25.3",
"ng2-file-upload": "^1.4.0",
"ngx-toastr": "^12.0.1",
"ramda": "^0.27.0",
"reflect-metadata": "~0.1.13",
"rxjs": "~6.5.5",
"rxjs-compat": "~6.5.5",
"tachyons-sass": "^4.9.5",
"tslib": "^1.11.2",
"typedjson": "^1.5.1",
"zone.js": "~0.10.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.901.5",
"#angular-devkit/core": "9.1.5",
"#angular-devkit/schematics": "9.1.5",
"#angular/cli": "9.1.5",
"#angular/compiler-cli": "9.1.6",
"#angular/language-service": "9.1.6",
"#nrwl/schematics": "8.12.11",
"#schematics/angular": "9.1.3",
"#types/highcharts": "5.0.4",
"#types/jasmine": "^3.5.10",
"#types/jasminewd2": "~2.0.8",
"#types/node": "^13.13.4",
"codelyzer": "^5.2.2",
"fibers": "^3.1.0",
"html-webpack-plugin": "^4.2.1",
"jasmine-core": "^3.5.0",
"jasmine-marbles": "0.3.1",
"jasmine-spec-reporter": "^5.0.2",
"karma": "~5.0.5",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "^3.0.2",
"karma-jasmine": "^3.1.1",
"karma-jasmine-html-reporter": "^1.5.3",
"ng-mocks": "^9.3.0",
"node-sass": "^4.14.0",
"prettier": "^1.18.2",
"protractor": "^5.4.4",
"remote-redux-devtools": "^0.5.16",
"ts-node": "~8.10.1",
"tslint": "~6.1.2",
"typescript": "~3.8.3"
}
Everything works fine in Angular 8. This error only occurs on my current branch where I am trying to update to the latest Angular 9. But I'm not sure how a front end issue could be causing the error I'm seeing. Could this be a problem with one of the NPM package updates?
Any help is appreciated.
Try these steps:
Delete node-modules folder C:\Users\USER\AppData\Roaming\npm\node_modules
Open windows powershell as admin
npm cache clean --force
npm install -g npm#latest
npm uninstall -g angular-cli
npm install -g #angular/cli#latest

Seeing error when I tried to update Angular CLI version in the project

My project has the following dependencies in package.json.
"dependencies": {
"#angular/animations": "^6.0.3",
"#angular/cdk": "^6.1.0",
"#angular/common": "^6.0.3",
"#angular/compiler": "^6.0.3",
"#angular/core": "^6.0.3",
"#angular/forms": "^6.0.3",
"#angular/http": "^6.0.3",
"#angular/material": "^6.1.0",
"#angular/platform-browser": "^6.0.3",
"#angular/platform-browser-dynamic": "^6.0.3",
"#angular/router": "^6.0.3",
"core-js": "^2.4.1",
"json-server": "^0.12.1",
"moment": "^2.22.1",
"rxjs": "^6.2.0",
"rxjs-compat": "^6.2.0",
"zone.js": "^0.8.26"
}
I want to use version 6.1.0 so I updated the package.json to following
"dependencies": {
"#angular/animations": "^6.1.0",
"#angular/cdk": "^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/material": "^6.1.0",
"#angular/platform-browser": "^6.1.0",
"#angular/platform-browser-dynamic": "^6.1.0",
"#angular/router": "^6.0.3",
"core-js": "^2.5.4",
"json-server": "^0.12.1",
"moment": "^2.22.1",
"rxjs": "^6.2.0",
"rxjs-compat": "^6.2.0",
"zone.js": "^0.8.26"
}
But I notice an error from the IDE The installed version didn't match version range for few entries. I thought that if I specify new versions here then the versions will be automatically updated. Isn't that the case? How can I upgrade the dependencies?
I have ng installed both globally (version 6.2.1) and locally (version 6.0.7). Their versions are different. I want to update local to the higher version and to do this, I thought I'll just update entries in package.json.
I suppose the correct way is to run ng update and that should list all the packages that need updating. As I have ng installed both locally and globally, if I just do ng update, I see message ``.
To be sure that I am updating using the local version, I use npx ng update to list the modules which need updating and use npx ng update -all to update all of them.

WARNING in ./node_modules/pdfjs-dist/build/pdf.js Module not found: Error: Can't resolve 'zlib' in 'ui_angular_6\node_modules\pdfjs-dist\build'

I was trying to migrate my angular 5 code to angular 6.
After doing npm start getting the below problem
npm start
WARNING in ./node_modules/pdfjs-dist/build/pdf.js
Module not found: Error: Can't resolve 'zlib' in '\ui_angular_6\node_modules\pdfjs-dist\build'
Package.json
"dependencies": {
"#angular/animations": "6.0.2",
"#angular/common": "6.0.2",
"#angular/compiler": "6.0.2",
"#angular/core": "6.0.2",
"#angular/flex-layout": "^6.0.0-beta.15",
"#angular/forms": "6.0.2",
"#angular/http": "6.0.2",
"#angular/platform-browser": "6.0.2",
"#angular/platform-browser-dynamic": "6.0.2",
"#angular/router": "6.0.2",
"#ng-bootstrap/ng-bootstrap": "^1.1.2",
"angular-font-awesome": "^3.1.2",
"body-parser": "^1.18.2",
"bootstrap": "^4.1.0",
"core-js": "^2.4.1",
"elasticsearch": "^15.1.1",
"elasticsearch-browser": "^15.1.1",
"express": "^4.16.3",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"ng2-pdf-viewer": "^5.1.1",
"npm": "^6.0.1",
"popper.js": "^1.14.3",
"rxjs": "^6.1.0",
"rxjs-compat": "^6.1.0",
"underscore": "^1.8.3",
"zone.js": "^0.8.26"
}
Please help me to fix this issue.
Try by placing this in your package.json file:
"browser": {
"zlib":false }
There was a fix for this issue in the following PR https://github.com/mozilla/pdf.js/pull/9924 (merged 12 days ago). You may want upgrading to the latest "pdfjs-dist" to fix the issue.

angular2-google-maps causes ctorParameters.map error

I have an Ionic v2 app.
I've been trying to implement angular2-google-maps for ages but keep getting the error:
TypeError: ctorParameters.map is not a function
My packages.json (dependencies):
"dependencies": {
"#angular/common": "2.3.1",
"#angular/compiler": "2.3.1",
"#angular/compiler-cli": "2.3.1",
"#angular/core": "2.3.1",
"#angular/forms": "2.3.1",
"#angular/http": "2.3.1",
"#angular/platform-browser": "2.3.1",
"#angular/platform-browser-dynamic": "2.3.1",
"#angular/platform-server": "2.3.1",
"#ionic/storage": "1.1.6",
"angular2-google-maps": "^0.17.0",
"angularfire2": "^2.0.0-beta.6",
"firebase": "^3.6.4",
"ionic-angular": "2.0.0-rc.4",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.7.4"
},
Looking here and questions similar, I updated all of my packages to (what I think to be) the correct versions (i.e. ionic-angular from rc3 to rc4) as, from what I can see, this error is usually caused by a mismatch of package versions.
I followed this tutorial but he talks of a different problem with integrating with ionic and didn't fix my own.
My app.module.ts follows the same as the tutorial:
import { AgmCoreModule } from "angular2-google-maps/core";
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
// AgmCoreModule.forRoot({
// apiKey: "AIzaSyDUdGaRHXhN5oy5zpETRll8KsHnvx19_9Y"
// }),
AngularFireModule.initializeApp(firebaseConfig, firebaseAuthConfig)
],
As that code is, it would work. However, if I uncomment AgmCoreModule.forRoot() that is when I get the error.
I cannot find anywhere where anyone has replicated or had the same error.
Also, starting a blank ionic v2 project with the same dependencies and enabling AgmCoreModule.forRoot() works which leads me to believe that it might be my project. However, all the configs are the exact same and I don't know where else would cause this error.
ANSWER:
The error was the angular2-google-maps version. I was using 0.17.0 whereas 0.16.0 is required for an Ionic v2 app. The answer below describes that downgrading your angular version may help as well but I did not deem this necessary. In any case, this is my new set of dependencies in package.json:
"dependencies": {
"#angular/common": "2.2.1",
"#angular/compiler": "2.2.1",
"#angular/compiler-cli": "2.2.1",
"#angular/core": "2.2.1",
"#angular/forms": "2.2.1",
"#angular/http": "2.2.1",
"#angular/platform-browser": "2.2.1",
"#angular/platform-browser-dynamic": "2.2.1",
"#angular/platform-server": "2.2.1",
"#ionic/storage": "1.1.7",
"angular2-google-maps": "0.16.0",
"angularfire2": "^2.0.0-beta.6",
"firebase": "^3.6.4",
"ionic-angular": "2.0.0-rc.4",
"ionic-native": "2.2.11",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
}
You could try downgrading angular maps to 0.16
This seems to be a known issue and is logged in github.
It seems to angular issue rather than ionic version mismatch.
A number of commentators have mentioned it to be working after the downgrade.
Also a fresh ionic 2 project seems to be using 2.2.1 angular version here
You could try downgrading that as well.
Hope it helps.