HTMLElement is not defined - Nativescript-vue - nativescript

All I'm trying to do at this point is get the project to run.
I run tns run android
The application builds, but as it starts the app and throws an error
ReferenceError: HTMLElement is not defined
So this all started when I was trying to bring in the new nativescript theme core (2.2.0). I followed the guide they have posted in several places. Everything looked good. Then I ran tns run android and got the HTMLElement is not defined error for the first time.
I've blown away the node_modules and platform folder
npm rebuild
tns install
I've uninstalled nativescript-cli & cleared npm cache and re-installed (As mentioned here: https://discourse.nativescript.org/t/enoent-no-such-file-or-directory-project-pbxproj/7336)
I then decided to start again proceed to start with a clean project. Following the steps here: https://nativescript-vue.org/en/docs/getting-started/quick-start/
And when I run tns run android I still get the same HTMLElement is not defined error, even when I didn't modify the template at all.
I don't know if this is a bug or if I'm doing something horribly wrong
tns --version 6.1.2
node -v 12.10.0
npm -v 6.10.3
So I am now getting this error no matter what I do now...
Code wise like I said I am getting this error with a clean pull of this template repo: https://github.com/nativescript-vue/vue-cli-template
Here is the Stack.
User-MacBook-Pro:hello-world user$ tns run android
Searching for devices...
Preparing project...
Bundling application for entryPath ./main...
File change detected. Starting incremental webpack compilation...
webpack is watching the files…
[BABEL] Note: The code generator has deoptimised the styling of /Users/scottbaron/Mos-Commodo/social-platform/peak-app/peak-matching/node_modules/#vue/devtools/build/backend.js as it exceeds the max of 500KB.
Hash: d11e779b2f173a00da85
Version: webpack 4.27.1
Time: 13195ms
Built at: 11/02/2019 10:57:09 AM
Asset Size Chunks Chunk Names
assets/images/NativeScript-Vue.png 8.22 KiB [emitted]
bundle.js 84.3 KiB bundle [emitted] bundle
package.json 165 bytes [emitted]
runtime.js 71.4 KiB runtime [emitted] runtime
tns-java-classes.js 0 bytes [emitted]
vendor.js 9.45 MiB vendor [emitted] vendor
Entrypoint bundle = runtime.js vendor.js bundle.js
[./ sync ^\.\/app\.(css|scss|less|sass)$] . sync nonrecursive ^\.\/app\.(css|scss|less|sass)$ 175 bytes {bundle} [built]
[./ sync recursive (?<!\bApp_Resources\b.*)\.(xml|css|js|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$] . sync (?<!\bApp_Resources\b.*)\.(xml|css|js|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$ 204 bytes {bundle} [built]
[./app.scss] 18.5 KiB {bundle} [optional] [built]
[./main.js] 1.96 KiB {bundle} [built]
[./package.json] 146 bytes {bundle} [optional] [built]
[./store.js] 142 bytes {bundle} [built]
+ 208 hidden modules
Webpack compilation complete. Watching for file changes.
Webpack build done!
Project successfully prepared (android)
Building project...
Gradle build...
+ setting applicationId
+ applying user-defined configuration from /Users/scottbaron/Mos-Commodo/social-platform/peak-app/peak-matching/app/App_Resources/Android/app.gradle
+ using andorid X library androidx.legacy:legacy-support-v4:1.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: /Users/scottbaron/Mos-Commodo/social-platform/peak-app/peak-matching/node_modules/nativescript-socketio/platforms/android/fancylogger-release.aar
+ adding aar plugin dependency: /Users/scottbaron/Mos-Commodo/social-platform/peak-app/peak-matching/node_modules/tns-core-modules-widgets/platforms/android/widgets-release.aar
Project successfully built.
The build result is located at: /Users/scottbaron/Mos-Commodo/social-platform/peak-app/peak-matching/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Installing on device 89EY06CQP...
Successfully installed on device with identifier '89EY06CQP'.
Restarting application on device 89EY06CQP...
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
System.err: ReferenceError: HTMLElement is not defined
System.err: File: "file:///node_modules/#vue/devtools/build/hook.js:517:28
System.err:
System.err: StackTrace:
System.err: Frame: function:'handleCopy', file:'file:///node_modules/#vue/devtools/build/hook.js:517:28
System.err: Frame: function:'clone', file:'file:///node_modules/#vue/devtools/build/hook.js:637:11
System.err: Frame: function:'', file:'file:///node_modules/#vue/devtools/build/hook.js:199:24
System.err: Frame: function:'on', file:'file:///node_modules/#vue/devtools/build/hook.js:145:11
System.err: Frame: function:'emit', file:'file:///node_modules/#vue/devtools/build/hook.js:179:17
System.err: Frame: function:'devtoolPlugin', file:'file:///node_modules/vuex/dist/vuex.esm.js:54:14
System.err: Frame: function:'Store', file:'file:///node_modules/vuex/dist/vuex.esm.js:356:4
System.err: Frame: function:'./store.js', file:'file:///app/store.js:6:15
System.err: Frame: function:'__webpack_require__', file:'file:///app/webpack/bootstrap:750:0
System.err: Frame: function:'fn', file:'file:///app/webpack/bootstrap:120:0
System.err: Frame: function:'', file:'file:///app/main.js:1:0
System.err: Frame: function:'./main.js', file:'file:///data/data/com.moscommodo.peak/files/app/bundle.js', line: 339, column: 30
System.err: Frame: function:'__webpack_require__', file:'file:///app/webpack/bootstrap:750:0
System.err: Frame: function:'checkDeferredModules', file:'file:///app/webpack/bootstrap:43:0
System.err: Frame: function:'webpackJsonpCallback', file:'file:///app/webpack/bootstrap:30:0
System.err: Frame: function:'', file:'file:///data/data/com.moscommodo.peak/files/app/bundle.js', line: 2, column: 57
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: ReferenceError: HTMLElement is not defined
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
System.err: ReferenceError: HTMLElement is not defined
System.err: File: "file:///node_modules/#vue/devtools/build/hook.js:517:28
System.err:
System.err: StackTrace:
System.err: Frame: function:'handleCopy', file:'file:///node_modules/#vue/devtools/build/hook.js:517:28
System.err: Frame: function:'clone', file:'file:///node_modules/#vue/devtools/build/hook.js:637:11
System.err: Frame: function:'', file:'file:///node_modules/#vue/devtools/build/hook.js:199:24
System.err: Frame: function:'on', file:'file:///node_modules/#vue/devtools/build/hook.js:145:11
System.err: Frame: function:'emit', file:'file:///node_modules/#vue/devtools/build/hook.js:179:17
System.err: Frame: function:'devtoolPlugin', file:'file:///node_modules/vuex/dist/vuex.esm.js:54:14
System.err: Frame: function:'Store', file:'file:///node_modules/vuex/dist/vuex.esm.js:356:4
System.err: Frame: function:'./store.js', file:'file:///app/store.js:6:15
System.err: Frame: function:'__webpack_require__', file:'file:///app/webpack/bootstrap:750:0
System.err: Frame: function:'fn', file:'file:///app/webpack/bootstrap:120:0
System.err: Frame: function:'', file:'file:///app/main.js:1:0
System.err: Frame: function:'./main.js', file:'file:///data/data/com.moscommodo.peak/files/app/bundle.js', line: 339, column: 30
System.err: Frame: function:'__webpack_require__', file:'file:///app/webpack/bootstrap:750:0
System.err: Frame: function:'checkDeferredModules', file:'file:///app/webpack/bootstrap:43:0
System.err: Frame: function:'webpackJsonpCallback', file:'file:///app/webpack/bootstrap:30:0
System.err: Frame: function:'', file:'file:///data/data/com.moscommodo.peak/files/app/bundle.js', line: 2, column: 57
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: ReferenceError: HTMLElement is not defined
System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6465)
System.err: at android.app.ActivityThread.access$1300(ActivityThread.java:219)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
System.err: at android.os.Handler.dispatchMessage(Handler.java:107)
System.err: at android.os.Looper.loop(Looper.java:214)
System.err: at android.app.ActivityThread.main(ActivityThread.java:7356)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
System.err: Caused by: com.tns.NativeScriptException: Error calling module function
System.err: ReferenceError: HTMLElement is not defined
System.err: File: "file:///node_modules/#vue/devtools/build/hook.js:517:28
System.err:

I found the solution, update your main.js file
import store from './store' // <= this should be before VueDevtools
import VueDevtools from 'nativescript-vue-devtools';

The solution that #sidheart pointed out works but it will not let you observe the store. The error is triggered because NativeScript does not have a DOM and therefore has no types for HTMLElement. A temporary solution is to add the line below to the object defined by new webpack.DefinePlugin({}) in the file webpack.config.js:
HTMLElement: function() {
return false;
},
so that the full object looks like this:
new webpack.DefinePlugin({
'global.TNS_WEBPACK': 'true',
TNS_ENV: JSON.stringify(mode),
process: 'global.process',
HTMLElement: function() {
return false;
},
}),
Thanks to Brandon Gohsman for showing this solution in his article.

When you create a project using:
vue init nativescript-vue/vue-cli-template <project-name>
Don't install vue-devtools. I think it has something to do with vue-devtools trying to access the DOM which doesn't exist in Nativescript.

Related

Class 'Public_Controller' not found in codeigniter

Same code is run properly in localhost but on server its show error
An uncaught Exception was encountered
Type: Error
Message: Class 'Public_Controller' not found
Filename: /home/referralearn/public_html/techmaa.org/portal/application/controllers/Auth.php
Line Number: 4
Backtrace:
File: /home/referralearn/public_html/techmaa.org/portal/index.php
Line: 314
Function: require_once
help me to solve this

Crash xamarin app at start up, Failed resolution of: Lcom/google/android/datatransport/runtime/dagger/internal/Factory;

Here is the crash log:
2021-11-09 14:09:39.214 30577-30577/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.bosch.smartcamera.test, PID: 30577 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/datatransport/runtime/dagger/internal/Factory; at com.google.android.datatransport.runtime.DaggerTransportRuntimeComponent.builder(DaggerTransportRuntimeComponent.java:70) at com.google.android.datatransport.runtime.TransportRuntime.initialize(TransportRuntime.java:76) at com.google.firebase.datatransport.TransportRegistrar.lambda$getComponents$0(TransportRegistrar.java:37) at com.google.firebase.datatransport.-$$Lambda$TransportRegistrar$cPZPPfWZLxVwhtSgzJNU9TpSidE.create(Unknown Source:0) at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0(ComponentRuntime.java:132) at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$ComponentRuntime(Unknown Source:0) at com.google.firebase.components.-$$Lambda$ComponentRuntime$4FqOW9eOQsvFYo-HpMfxCOnPQr0.get(Unknown Source:4) at com.google.firebase.components.Lazy.get(Lazy.java:53) at com.google.firebase.components.AbstractComponentContainer.get(AbstractComponentContainer.java:27) at com.google.firebase.components.ComponentRuntime.get(ComponentRuntime.java:45) at com.google.firebase.components.RestrictedComponentContainer.get(RestrictedComponentContainer.java:89) at com.google.firebase.messaging.FirebaseMessagingRegistrar.lambda$getComponents$0$FirebaseMessagingRegistrar(com.google.firebase:firebase-messaging##22.0.0:7) at com.google.firebase.messaging.FirebaseMessagingRegistrar$$Lambda$0.create(Unknown Source:0) at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0(ComponentRuntime.java:132) at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$ComponentRuntime(Unknown Source:0) at com.google.firebase.components.-$$Lambda$ComponentRuntime$4FqOW9eOQsvFYo-HpMfxCOnPQr0.get(Unknown Source:4) at com.google.firebase.components.Lazy.get(Lazy.java:53) at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(ComponentRuntime.java:291) at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(ComponentRuntime.java:281) at com.google.firebase.FirebaseApp.initializeAllApis(FirebaseApp.java:584) at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:303) at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267) at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252) at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51) at android.content.ContentProvider.attachInfo(ContentProvider.java:2092) at android.content.ContentProvider.attachInfo(ContentProvider.java:2066) at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45) at android.app.ActivityThread.installProvider(ActivityThread.java:7237) at android.app.ActivityThread.installContentProviders(ActivityThread.java:6782) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6693) at android.app.ActivityThread.access$1400(ActivityThread.java:232) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2014) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:241) at android.app.ActivityThread.main(ActivityThread.java:7617) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941) Caused by: java.lang.ClassNotFoundException: com.google.android.datatransport.runtime.dagger.internal.Factory at com.google.android.datatransport.runtime.DaggerTransportRuntimeComponent.builder(DaggerTransportRuntimeComponent.java:70)  at com.google.android.datatransport.runtime.TransportRuntime.initialize(TransportRuntime.java:76)  at com.google.firebase.datatransport.TransportRegistrar.lambda$getComponents$0(TransportRegistrar.java:37)  at com.google.firebase.datatransport.-$$Lambda$TransportRegistrar$cPZPPfWZLxVwhtSgzJNU9TpSidE.create(Unknown Source:0)  at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0(ComponentRuntime.java:132)  at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$ComponentRuntime(Unknown Source:0)  at com.google.firebase.components.-$$Lambda$ComponentRuntime$4FqOW9eOQsvFYo-HpMfxCOnPQr0.get(Unknown Source:4)  at com.google.firebase.components.Lazy.get(Lazy.java:53)  at com.google.firebase.components.AbstractComponentContainer.get(AbstractComponentContainer.java:27)  at com.google.firebase.components.ComponentRuntime.get(ComponentRuntime.java:45)  at com.google.firebase.components.RestrictedComponentContainer.get(RestrictedComponentContainer.java:89)  at com.google.firebase.messaging.FirebaseMessagingRegistrar.lambda$getComponents$0$FirebaseMessagingRegistrar(com.google.firebase:firebase-messaging##22.0.0:7)  at com.google.firebase.messaging.FirebaseMessagingRegistrar$$Lambda$0.create(Unknown Source:0)  at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0(ComponentRuntime.java:132)  at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$ComponentRuntime(Unknown Source:0)  at com.google.firebase.components.-$$Lambda$ComponentRuntime$4FqOW9eOQsvFYo-HpMfxCOnPQr0.get(Unknown Source:4)  at com.google.firebase.components.Lazy.get(Lazy.java:53)  at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(ComponentRuntime.java:291)  at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(ComponentRuntime.java:281)  at com.google.firebase.FirebaseApp.initializeAllApis(FirebaseApp.java:584)  at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:303)  at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)  at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)  at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)  at android.content.ContentProvider.attachInfo(ContentProvider.java:2092)  at android.content.ContentProvider.attachInfo(ContentProvider.java:2066)  at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)  at android.app.ActivityThread.installProvider(ActivityThread.java:7237)  at android.app.ActivityThread.installContentProviders(ActivityThread.java:6782)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6693)  at android.app.ActivityThread.access$1400(ActivityThread.java:232)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2014)  at android.os.Handler.dispatchMessage(Handler.java:107)  at android.os.Looper.loop(Looper.java:241)  at android.app.ActivityThread.main(ActivityThread.java:7617)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941) 2021-11-09 14:09:39.279 4694-12739/? W/ActivityTaskManager: Force finishing activity
You need to install Xamarin.Google.Dagger from the Nuget package manager

Nativescript - TypeError: Cannot read property 'LayoutParams' of undefined

tns 2.5.0-2016-11-16-7142
npm 3.10.9
This is a NS-ng project with very minimal code. On running, the cli throws this -
java.lang.RuntimeException: Unable to resume activity
{org.nativescript.fundoo/com.tns.NativeScriptActivity}:
com.tns.NativeScriptException: Calling js method onCreateView failed
TypeError: Cannot read property 'LayoutParams' of undefined File:
"/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/core/view.js,
line: 507, column: 68
StackTrace: Frame:
function:'ViewStyler.setNativeLayoutParamsProperty',
file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/core/view.js',
line: 507, column: 69 Frame:
function:'StylePropertyChangedHandler.applyProperty',
file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/styling/style.js',
line: 1326, column: 14 Frame: function:'Style._applyStyleProperty',
file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/styling/style.js',
line: 1086, column: 25 Frame: function:'Style._applyProperty',
file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/styling/style.js',
line: 1049, column: 14 Frame: function:'Style._onP
This supposedly had to do with the module versions but I have it updated :
"tns-core-modules": "^2.5.0-2016-11-16-4793",
"tns-core-modules-widgets": "^2.5.0-2016-11-10-154"

Unknown Provider error while unit testing in jasmine

I have a module as below in a js file
app.js
angular.module( 'app', [ 'ui.bootstrap', 'routes', 'module2', 'ngAnimate', 'ngSanitize' ] );
If i am to write a unit test case then how should i load the modules in my unit test case??
Is it this way
module('app');
Other way
module('ui.bootstrap');
module('routes');
module('module2');
module('ngAnimate');
module('ngSanitize');
Which is right order or the right way to load the module...As am always getting the below error
Error: [$injector:unpr] Unknown provider: deepakProvider <- deepak
http://errors.angularjs.org/1.4.9/$injector/unpr?p0=deepakProvider%20%3C-%20deepak
at C:/jasmine/InformedEnrollment2/src/webapp/informedenrollment2/webclnt/components/angular/angular.js:68:12
at C:/jasmine/project/src/webapp/project/webclnt/components/angular/angular.js:4346:19
at Object.getService [as get] (C:/jasmine/project/src/webapp/project/webclnt/components/angular/angular.js:4494:39)
at C:/jasmine/project/src/webapp/project/webclnt/components/angular/angular.js:4351:45
at Object.getService [as get] (C:/jasmine/project/src/webapp/project/webclnt/components/angular/angular.js:4494:39)
at Object.<anonymous> (C:/jasmine/project/tests/DemoToTheTeam.js:20:47)
at Object.invoke (C:/jasmine/project/src/webapp/project/webclnt/components/angular/angular.js:4535:17)
at Object.workFn (C:/jasmine/project/node_modules/angular-mocks/angular-mocks.js:3071:20)
Error: Declaration Location
at window.inject.angular.mock.inject (C:/jasmine/project/node_modules/angular-mocks/angular-mocks.js:3033:25)
at Suite.<anonymous> (C:/jasmine/project/tests/DemoToTheTeam.js:19:15)
at C:/jasmine/project/tests/DemoToTheTeam.js:2:1
TypeError: Cannot read property 'multiply' of undefined
at Object.<anonymous> (C:/jasmine/project/tests/DemoToTheTeam.js:26:13)
50.0.2661 (Windows 7 0.0.0): Executed 7 of 7 (1 FAILED) (0.182 secs / 0.064 secs)

Joomla 3.2: Undefined offset: 0 in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 479

My website Joomla 3.2 website was running well recently, when I got this error message and things don't work anymore.
Notice: Undefined offset: 0 in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 479
Notice: Trying to get property of non-object in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483
Warning: Creating default object from empty value in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483
Notice: Undefined offset: 0 in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 479
Notice: Trying to get property of non-object in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483
Warning: Creating default object from empty value in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483
Error displaying the error page: Could not find template "".

Resources