Error during webpack build with jasmine - jasmine

My webpack build started failing. The error I'm getting is this:
asset optimizationError in bail mode: [default]
C:\Personal\Development\mum-
app\mum-frontend-angular\node_modules\#types\jasmine\index.d.ts:39:37
A parameter initializer is only allowed in a function or constructor implementation.
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
I have not changed any of my dependencies, however, some are a bit outdated. I haven't had any problems with the current setup before. My package.json looks like this:
{
"name": "mum-ngui-web",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/common": "2.4.5",
"#angular/compiler": "2.4.5",
"#angular/core": "2.4.5",
"#angular/forms": "2.4.5",
"#angular/http": "2.4.5",
"#angular/platform-browser": "2.4.5",
"#angular/platform-browser-dynamic": "2.4.5",
"#angular/router": "3.4.5",
"core-js": "2.4.1",
"ng2-translate": "5.0.0",
"rxjs": "5.0.3",
"ts-helpers": "^1.1.2",
"zone.js": "^0.7.6"
},
"devDependencies": {
"#types/jasmine": "^2.5.40",
"#types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.19-3",
"awesome-typescript-loader": "3.0.0-beta.18",
"codelyzer": "~2.0.0-beta.4",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-remap-istanbul": "^0.4.0",
"protractor": "5.0.0",
"ts-node": "2.0.0",
"tslint": "4.4.2",
"typescript": "~2.1.5"
}
}
Can anyone tell me what I'm doing wrong?
Thanks!

I had the same problem.
Locking my jasmine version fixed it.
So in your case, try replacing
"#types/jasmine": "^2.5.40",
by
"#types/jasmine": "2.5.40",
also I think this is the issue itself on the github:
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14579

Related

Uncaught TypeError: Cannot read properties of undefined (reading 'document')

I am using nvd3 charts(nvd3-1.8.5, d3-3.5.17), facing the below issue after Upgrading from angular 12 to angular 14. When it was in angular 12 I didn't face any issues.
Uncaught TypeError: Cannot read properties of undefined (reading 'document')
at d3.js:8:26
at 83064 (d3.js:1:2)
at __webpack_require__ (bootstrap:19:1)
at 54058 (index.ts:8:44)
at __webpack_require__ (bootstrap:19:1)
at 84096 (settings.saveview.html:41:141)
at __webpack_require__ (bootstrap:19:1)
at 70299 (UserServiceResolver.ts:18:33)
at __webpack_require__ (bootstrap:19:1)
at 64349 (viewlogmessage.html:65:57)
Even I tried with nvd3 1.8.5 with d3 4.0.0(With Angular 14) getting the below issue.
core.mjs:6397 ERROR TypeError: nv.dispatch.render_start is not a function
at Object.render (nv.d3.js:93:17)
at nv.addGraph (nv.d3.js:145:12)
at ViewActionsComponent.ts:169:17
at Array.forEach (<anonymous>)
at ViewActionsComponent.onGetMessageSuccessCallback (ViewActionsComponent.ts:140:11)
at SafeSubscriber._next (ViewActionsComponent.ts:83:36)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:183:16)
at SafeSubscriber.next (Subscriber.js:122:22)
at Subscriber._next (Subscriber.js:72:26)
at Subscriber.next (Subscriber.js:49:18)
Adding package.json configuration for reference.
"devDependencies": {
"#angular-devkit/build-angular": "^14.0.2",
"#angular/cli": "^14.0.2",
"#angular/compiler-cli": "^14.0.2",
"#types/ace": "0.0.32",
"#types/angular": "1.6.21",
"#types/argparse": "1.0.30",
"#types/ckeditor": "0.0.37",
"#types/core-js": "0.9.36",
"#types/d3": "^3.5.47",
"#types/d3pie": "^0.1.5",
"#types/glob": "5.0.30",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "2.0.2",
"#types/jquery": "3.5.6",
"#types/lodash": "^4.14.182",
"#types/minimatch": "2.0.29",
"#types/node": "^12.20.50",
"#types/nvd3": "^1.8.42",
"#types/shelljs": "0.7.0",
"access-sniff": "2.4.61",
"angular2-template-loader": "0.6.2",
"argparse": "1.0.9",
"awesome-typescript-loader": "3.1.2",
"babel-preset-es2015": "6.18.0",
"bootstrap": "3.4.1",
"codelyzer": "^6.0.0",
"copy-webpack-plugin": "4.0.1",
"copyfiles": "1.0.0",
"cross-env": "^5.0.5",
"css-loader": "0.27.3",
"d3": "4.0.0",
"d3pie": "0.1.5",
"extract-text-webpack-plugin": "3.0.2",
"file-appender": "^1.1.0",
"fs": "0.0.1-security",
"fs-extra": "5.0.0",
"glob": "7.1.1",
"glob-concat": "^1.0.1",
"gnomon": "1.5.0",
"increase-memory-limit": "^1.0.3",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"js-yaml": "^3.13.1",
"less": "2.7.1",
"less-loader": "4.0.5",
"less-plugin-clean-css": "1.5.1",
"lite-server": "^2.6.1",
"mkdirp": "^0.5.6",
"ncp": "2.0.0",
"npm-build-tools": "^2.2.5",
"nvd3": "1.8.5",
"perfect-scrollbar": "0.8.1",
"protractor": "~7.0.0",
"raw-loader": "0.5.1",
"remap-istanbul": "0.7.0",
"rimraf": "2.5.4",
"rollup-loader": "^0.3.0",
"shelljs": "0.7.5",
"style-loader": "0.16.1",
"systemjs": "^6.12.1",
"time-grunt": "^1.4.0",
"to-string-loader": "1.1.5",
"ts-helpers": "1.1.1",
"ts-node": "~3.2.0",
"tslint": "~6.1.0",
"typedoc": "0.5.7",
"typescript": "~4.6.4",
"uglify-js": "3.0.26",
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"#angular/animations": "^14.0.2",
"#angular/common": "^14.0.2",
"#angular/compiler": "^14.0.2",
"#angular/core": "^14.0.2",
"#angular/forms": "^14.0.2",
"#angular/localize": "^14.0.2",
"#angular/platform-browser": "^14.0.2",
"#angular/platform-browser-dynamic": "^14.0.2",
"#angular/platform-server": "^14.0.2",
"#angular/router": "^14.0.2",
"#ng-bootstrap/ng-bootstrap": "^9.1.3",
"#ngx-translate/core": "^13.0.0",
"#ngx-translate/http-loader": "^6.0.0",
"#types/bootstrap": "^5.1.10",
"ace-builds": "^1.4.14",
"ag-grid-angular": "^26.1.0",
"ag-grid-community": "^26.1.0",
"circular-dependency-plugin": "^5.2.2",
"commonjs-require": "1.4.6",
"core-js": "^2.6.7",
"es6-collections": "0.5.6",
"es6-promise": "3.3.1",
"es6-shim": "0.34.1",
"fs": "0.0.1-security",
"jquery": "^3.6.0",
"moment": "^2.29.3",
"pdfjs-dist": "2.0.489",
"plotly.js": "2.12.1",
"plugin-typescript": "4.0.17",
"reflect-metadata": "0.1.9",
"rxjs": "^6.6.0",
"rxjs-compat": "^6.6.7",
"rxjs-tslint": "^0.1.8",
"ts-smart-logger": "0.0.4",
"tslib": "^2.4.0",
"webpack": "^5.73.0",
"zone.js": "^0.11.5"
}
Any idea how to fix this error?
I know it might be no a right fix, but
remove all import d3
use CDN link in your index.html file:
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.7/d3.min.js"
integrity="sha512-MbgT+83UxCH6sDPhdRyAqCvG+93y1xm6SIC/1T15gWsbkC2bjGqHVWepfhPMocnEOhgXBtZCOxHmwq0XPsqSGQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
I've faced same issue, so I took ^ actions.
Regarding types d3 js types, u can have it as dependecies.

Stuck on build error on migration of basic Tabs from {N} 6 to 8

We have an app written in NativeScript Angular and based on BottomNavigation and TabView.
I've posted before about issues we have had building our app after migrating from NativeScript 6 to 8.
I can't share our code base so I have taken the legacy code in {N} 6 and stripped out all of our own components to leave just the bare bones.
There is a public repo here: https://github.com/syborp/testapp
It builds and runs fine in {N} 6 and there is a screenshot on the GitHub README.
When we migrate to {N} 8 we keep ending up at this error.
Searching for devices...
Preparing project...
webpack is watching the files...
C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40
throw new Error("The target entry-point \"" + invalidTarget.entryPoint.name + "\" has missing dependencies:\n" +
^
Error: The target entry-point "undefined" has missing dependencies:
- nativescript-angular/element-registry
at TargetedEntryPointFinder.findEntryPoints (C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40:23)
at C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\execution\analyze_entry_points.js:29:41
at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\execution\single_process_executor.js:28:29)
at C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:59
at SyncLocker.lock (C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\locking\sync_locker.js:34:24)
at SingleProcessExecutorSync.execute (C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:27)
at Object.mainNgcc (C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\src\main.js:74:25)
at Object.process (C:\Users\user\testapp\node_modules\#angular\compiler-cli\ngcc\index.js:29:23)
at NgccProcessor.processModule (C:\Users\user\testapp\node_modules\#ngtools\webpack\src\ngcc_processor.js:175:16)
at C:\Users\user\testapp\node_modules\#ngtools\webpack\src\ivy\host.js:146:18
at C:\Users\user\testapp\node_modules\#ngtools\webpack\src\ivy\host.js:76:24
at Array.map (<anonymous>)
at Object.host.resolveModuleNames (C:\Users\user\testapp\node_modules\#ngtools\webpack\src\ivy\host.js:74:32)
at actualResolveModuleNamesWorker (C:\Users\user\testapp\node_modules\typescript\lib\typescript.js:109497:133)
at resolveModuleNamesWorker (C:\Users\user\testapp\node_modules\typescript\lib\typescript.js:109760:26)
at resolveModuleNamesReusingOldState (C:\Users\user\testapp\node_modules\typescript\lib\typescript.js:109857:24)
Executing webpack failed with exit code 1.
It sounds like the entry point main.ts cannot be found but I think it looks ok in package.json.
"description": "Test App",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"scripts": {
"lint": "tslint \"app/**/*.ts\""
},
"dependencies": {
"#angular/animations": "^12.2.5",
"#angular/common": "^12.2.5",
"#angular/compiler": "^12.2.5",
"#angular/core": "^12.2.5",
"#angular/forms": "^12.2.5",
"#angular/http": "8.0.0-beta.10",
"#angular/platform-browser": "^12.2.5",
"#angular/platform-browser-dynamic": "^12.2.5",
"#angular/router": "^12.2.5",
"#master.technology/permissions": "^2.0.1",
"#nativescript/angular": "^12.2.0",
"#nativescript/core": "~8.1.1",
"#nativescript/fingerprint-auth": "^8.0.0",
"nativescript": "^6.5.0",
"nativescript-app-sync": "^2.0.0",
"nativescript-bottom-navigation": "^2.0.5",
"nativescript-camera": "^4.0.2",
"nativescript-drop-down": "^5.0.6",
"nativescript-fancyalert": "^3.0.9",
"nativescript-fingerprint-auth": "^7.0.2",
"nativescript-fontawesome": "^1.0.0",
"nativescript-gradient": "^2.0.1",
"nativescript-imagepicker": "^7.1.0",
"nativescript-iqkeyboardmanager": "^1.5.1",
"nativescript-modal-datetimepicker": "^1.1.4",
"nativescript-pdf-view": "^2.1.0",
"nativescript-permissions": "^1.3.12",
"nativescript-theme-core": "~1.0.4",
"nativescript-toast": "^1.4.6",
"nativescript-ui-listview": "^10.0.2",
"reflect-metadata": "~0.1.10",
"ruby": "^0.6.1",
"rxjs": "~7.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "^13.2.5",
"#angular/cli": "^12.2.5",
"#angular/compiler-cli": "^12.2.5",
"#nativescript/android": "~8.1.1",
"#nativescript/webpack": "~5.0.0",
"#ngtools/webpack": "^12.2.5",
"#types/node": "14.6.2",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"codelyzer": "~4.5.0",
"extract-text-webpack-plugin": "~3.0.2",
"lazy": "1.0.11",
"sass": "~1.39.0",
"tslint": "~5.12.1",
"typescript": "~4.3.5",
"uglifyjs-webpack-plugin": "^2.2.0"
},
"main": "./app/main.ts"
}
Or is it a webpack issue?
Any advice much appreciated.
TIA.

SASS compiler failed with exit code 1

I'm following the official getting started with NativeScript/Angular and working on this repo when I do tns run android I get the following:
Executing before-watch hook from /Projects/course-exercise-files-nativescript-angular-getting-started-guide/chapter2/02_07_end/Groceries/hooks/before-watch/nativescript-dev-sass.js
Found peer node-sass
No input file was found.
SASS compiler failed with exit code 1
My node version is: 10.15.1 on a Mac OS Mojave 10.14.2
Here is my package.json :
{
"nativescript": {
"id": "org.nativescript.Groceries",
"tns-android": {
"version": "5.0.0"
},
"tns-ios": {
"version": "5.0.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"#angular/animations": "7.0.0",
"#angular/common": "7.0.0",
"#angular/compiler": "7.0.0",
"#angular/core": "7.0.0",
"#angular/forms": "7.0.0",
"#angular/http": "7.0.0",
"#angular/platform-browser": "7.0.0",
"#angular/platform-browser-dynamic": "7.0.0",
"#angular/router": "7.0.0",
"nativescript-angular": "7.0.0",
"nativescript-theme-core": "1.0.4",
"reflect-metadata": "0.1.10",
"rxjs": "6.3.0",
"tns-core-modules": "5.0.2",
"zone.js": "0.8.4"
},
"devDependencies": {
"#nativescript/schematics": "~0.4.0",
"codelyzer": "~4.5.0",
"nativescript-dev-sass": "~1.6.0",
"nativescript-dev-typescript": "~0.7.0",
"nativescript-dev-webpack": "~0.18.0",
"tslint": "~5.11.0",
"typescript": "^3.1.6",
"#angular/compiler-cli": "~7.0.0",
"#ngtools/webpack": "~7.0.0"
},
"readme": "NativeScript Application"
}
I tried many suggestions on other issues discussion but without success.
You will see that error only when you don't have even one SCSS file in your project. Add at least one SCSS file to your project and the error should go away.

Cannot find type definition file for 'rx/rx.all'

I have trying to get material2 select to work in my application but it appears I am missing something.
I keep getting the error
"Error TS2688 Build:Cannot find type definition file for 'rx/rx.all'"
Below is package.json
{
"version": "1.0.0",
"name": "reportbook",
"dependencies": {
"#angular/common": "~2.4.0",
"#angular/compiler": "~2.4.0",
"#angular/core": "~2.4.0",
"#angular/forms": "~2.4.0",
"#angular/http": "~2.4.0",
"#angular/material": "~2.0.0-beta.2",
"#angular/platform-browser": "~2.4.0",
"#angular/platform-browser-dynamic": "~2.4.0",
"#angular/router": "~3.4.0",
"#angular/upgrade": "~2.4.0",
"#types/core-js": "~0.9.34",
"#types/hammerjs": "~2.0.33",
"#types/jasmine": "~2.5.43",
"#types/lodash": "4.14.50",
"#types/rx": "4.1.1",
"angular-in-memory-web-api": "~0.2.4",
"bootstrap": "~3.3.7",
"core-js": "~2.4.1",
"hammerjs": "~2.0.8",
"lodash": "~4.16.6",
"moment": "~2.16.0",
"ng2-bootstrap": "~1.3.3",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.0.0-beta.12",
"systemjs": "~0.19.41",
"zone.js": "~0.7.7"
},
"devDependencies": {
"del": "~2.2.2",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-tsc": "^1.2.5",
"gulp-typescript": "^2.14.1",
"hammerjs": "^2.0.8",
"path": "^0.12.7",
"tslint": "^3.15.1",
"typescript": "~2.1.6",
"gulp-sass": "~2.3.2",
"rimraf": "~2.3.2"
}
}
I will appreciate it very much if anyone can point me in th right direction
I ran into this issue and downgraded #types/rx from 4.1.1 to 2.5.34 and that seemed to work.

NativeScriptException: Failed to find module: "stream"

After upgrading a few items in my package.json I'm all of a sudden getting:
Error: com.tns.NativeScriptException: Failed to find module: "stream", relative to: /app/tns_modules/
StackTrace:
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'/data/data/org.nativescript.naturesnotebookmobile/files/app/tns_modules/parse5/lib/parser/stream.js', line: 3, column: 22
Any ideas? Previously I was at 2.0.0 for all the angular stuff and it was working then. Here is my package.json:
{
"dependencies": {
"#angular/common": "2.1.0",
"#angular/compiler": "2.1.0",
"#angular/core": "2.1.0",
"#angular/forms": "2.1.0",
"#angular/http": "2.1.0",
"#angular/platform-browser": "2.1.0",
"#angular/platform-browser-dynamic": "2.1.0",
"#angular/platform-server": "2.1.0",
"#angular/router": "3.1.0",
"crypto-js": "^3.1.7",
"nativescript-angular": "1.1.0",
... a few other things here...
"node-geocoder": "^3.15.0",
"oauth-signature": "^1.3.1",
"reflect-metadata": "^0.1.8",
"tns-core-modules": "2.3.0",
"util": "^0.10.3"
},
"devDependencies": {
"babel-traverse": "6.16.0",
"babel-types": "6.16.0",
"babylon": "6.12.0",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^2.0.3",
"zone.js": "^0.6.25"
}
}
The latest version of nativescript-angular does not require the #angular/platform-server
dependency. That dependency uses a different version of the parse5 which is causing this issue.
Simply remove it.

Resources