Which package is needed to import vue components? - nativescript

I'm new to nativescript and "npm-related" development development and trying to create my first NativeScript-Vue application, and have got some troubles.
1) First of all, when I use the import Vue from 'nativescript-vue'; syntax instead of const Vue = require('nativescript-vue'); I get such exception:
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application
com.tns.NativeScriptApplication: com.tns.NativeScriptException:
Cannot compile /data/data/org.nativescript.sirius/files/app/main.js
SyntaxError: Unexpected identifier
File: "file:///data/data/org.nativescript.sirius/files/app/main.js,
line: 1, column: 67
2) When trying to import vue components(with .vue extension) they are not even being found..
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application
com.tns.NativeScriptApplication: com.tns.NativeScriptException:
Error calling module function
Error: com.tns.NativeScriptException: Failed to find module:
"./components/test", relative to: app/
I suppose I have some packages missing, but have no idea which exactly.
Here is my package.json:
"nativescript": {
"id": "org.nativescript.sirius",
"tns-android": {
"version": "5.2.1"
}
},
"dependencies": {
"nativescript-theme-core": "^1.0.4",
"nativescript-vue": "^1.3.1",
"tns-core-modules": "^3.4.1"
},
"devDependencies": {}

Your dependencies seems pretty much old, the current nativescript-vue version is v2.2.0 and tns-core-modules is on v5.5.2.
Try using the official starter templates to create project via CLI.

Related

Nativescript - Https request not working on android platform v7.0.1

I´m completely lost on why this is happening, on previous versions everything worked well and on ios i don´t have any problems, but on android the below crashes:(i´m using the https module
https.request({
url: "https://my_link",
method: "POST",
body:{ "grupo": gotData.tappedItem.grupo },
allowLargeResponse:true,
headers:{
"Cache-Control": "no-cache",
"Content-Type":"application/json"
}
}).then((response) => {
And this also crashes:
https.request({
url: "https://my_link?grupo="+gotData.tappedItem.grupo,
method: "GET",
allowLargeResponse:true,
headers:{
"Cache-Control": "no-cache",
"Content-Type":"application/json"
}
}).then((response) => {
Is it the code? am i typing anything wrong?. I already tried deleting the platforms and delete from the device, and i have download the certificate to app/assets folder but it just doesn´t work and this is the error:
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onResponse failed
System.err: Error: android.os.NetworkOnMainThreadException
System.err:
System.err: StackTrace:
System.err: onResponse(file: node_modules/nativescript-https/https.android.js:492:0)
My tns info:
✔ Getting NativeScript components versions information...
✔ Component nativescript has 7.1.2 version and is up to date.
✔ Component #nativescript/core has 7.1.4 version and is up to date.
✔ Component #nativescript/ios has 7.1.1 version and is up to date.
✔ Component #nativescript/android has 7.0.1 version and is up to date.

How to fix "Unhandled Promise Rejection: Error: Unable to find module with ID: aurelia-bootstrap-datetimepicker" issue?

I am quite stuck in including Aurelia-Bootstrap-Datetimepicker and aurelia-datatable in my project. I have followed these two tutorials word by word:
https://www.npmjs.com/package/aurelia-bootstrap-datetimepicker
https://www.npmjs.com/package/aurelia-datatable
Unluckily in both of them I am getting same issue:
Unhandled Promise Rejection: Error: Unable to find module with ID: aurelia-bootstrap-datetimepicker
Unhandled Promise Rejection: Error: Unable to find module with ID: aurelia-datatable
I have observed that this error comes by including plugin in main.ts, like:
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.plugin(PLATFORM.moduleName('aurelia-validation'))
.feature(PLATFORM.moduleName('resources/index'))
.plugin('aurelia-bootstrap-datetimepicker');
aurelia.use.developmentLogging(environment.debug ? 'debug' : 'warn');
if (environment.testing) {
aurelia.use.plugin(PLATFORM.moduleName('aurelia-testing'));
}
aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
}
Is there any developer who have successfully configured both of these in his/her project? I could create a gist or something to share more stuff..
Or suggest me some other tutorial to follow for meeting both purposes.. Any help would be highly appreciated.
Since you're using Aurelia with Webpack,try to init the plugin with
.plugin(PLATFORM.moduleName('aurelia-bootstrap-datetimepicker'));

While building my NativeScript app for iOS I get CFBundleIdentifier not set

Project successfully built. The build result is located at:
/Volumes/projects/nativescript/bingoplus/platforms/ios/build/Debug-iphonesimulator/bingoplus.app
Installing on device BF118DE4-9A73-459B-A223-D5CB324F19AF... Unable to
apply changes on device: BF118DE4-9A73-459B-A223-D5CB324F19AF. Error
is: Command xcrun with arguments simctl install
BF118DE4-9A73-459B-A223-D5CB324F19AF
/Volumes/projects/nativescript/bingoplus/platforms/ios/build/Debug-iphonesimulator/bingoplus.app
failed with exit code 22. Error output: An error was encountered
processing the command (domain=NSPOSIXErrorDomain, code=22): Failed to
install the requested application The bundle identifier of the
application could not be determined. Ensure that the application's
Info.plist contains a value for CFBundleIdentifier.
Upon seeing that I added the entry to Info.plist but then on rebuild I got:
[WARNING]: The CFBundleIdentifier key inside the 'Info.plist' will be overriden by the 'id' inside 'package.json'.
And then the same error from above 'The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier."
package.json snippet:
{
"nativescript": {
"id": "bingo.bingoplus",
"tns-android": {
"version": "6.0.0"
},
"tns-ios": {
"version": "6.0.1"
}
Turns out this is a bug. Upgrade tns-core-modules to 6.0.4
https://github.com/NativeScript/nativescript-cli/issues/5073

invoking lambda function gives "errorMessage": "Cannot find module 'semver'"

I'm working on a lambda function and when I try to invoke it I get the following error
"errorMessage": "Cannot find module 'semver'".
details
Unable to import module 'dist/index': Error
If I add semver to package.json then it works fine. This started happening suddenly. A bit of background information, I'm using a monorepo with yarn and lerna.

How do I troubleshoot webpack --env.aot issues?

I'm trying to setup my app to use aot and also uglify. I can compile it using --bundle, but as soon as I add --env.aot or --env.uglify I can't get it to compile. With AOT I've quashed almost all of the errors. The only error I see is that it can't find a template and the path is wrong. I don't get it, though. I'm using a relative path with module.id.
#Component({
moduleId: module.id,
selector: 'test-radio',
templateUrl: './test-radio.component.html',
styleUrls: ['./test-radio.component.css']
})
The error when I build is:
JavaScript error:
file:///app/vendor.js:128056:103: JS ERROR Error: Could not resolve
test-radio.component.html. Looked for:
/Users/brice/Library/Developer/CoreSimulator/Devices/61560E27-9F8D-
430F-81D9-437A2E329F52/data/Containers/Bundle/Application/74041BF3-
8493-4EF2-BE46-F72257CC5C83/class2tns.app/app/test-radio.component.html.
But before that error, there is all this stuff:
ERROR in : Error: Cannot find module '#ngtools/webpack/src/utils'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (/Users/brice/source/class2tns/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.getResolvedEntryModule (/Users/brice/source/class2tns/node_modules/nativescript-dev-webpack/utils/transformers-utils.js:10:35)
at standardTransform (/Users/brice/source/class2tns/node_modules/nativescript-dev-webpack/transformers/ns-replace-bootstrap.js:16:50)
at transformer (/Users/brice/source/class2tns/node_modules/#ngtools/webpack/src/transformers/make_transform.js:21:25)
at /Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:1390:86
at reduceLeft (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:1102:30)
at /Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:1390:42
at transformRoot (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81154:82)
at Object.map (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:429:29)
at Object.transformNodes (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81141:30)
at emitJsFileOrBundle (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81497:32)
at emitSourceFileOrBundle (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81465:13)
at forEachEmittedFile (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81373:30)
at Object.emitFiles (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81454:9)
at emitWorker (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86927:33)
at /Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86887:66
at runWithCancellationToken (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86979:24)
at Object.emit (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86887:20)
at defaultEmitCallback (/Users/brice/source/class2tns/node_modules/#angular/compiler-cli/src/transformers/program.js:67:24)
at AngularCompilerProgram._emitRender2 (/Users/brice/source/class2tns/node_modules/#angular/compiler-cli/src/transformers/program.js:388:34)
at AngularCompilerProgram.emit (/Users/brice/source/class2tns/node_modules/#angular/compiler-cli/src/transformers/program.js:212:22)
at AngularCompilerPlugin._emit (/Users/brice/source/class2tns/node_modules/#ngtools/webpack/src/angular_compiler_plugin.js:850:49)
at Promise.resolve.then.then.then (/Users/brice/source/class2tns/node_modules/#ngtools/webpack/src/angular_compiler_plugin.js:676:54)
at process._tickCallback (internal/process/next_tick.js:68:7)
Running:
NativeScript CLI version: 5.4.1
CLI extension nativescript-cloud version: 1.17.6
CLI extension nativescript-starter-kits version: 0.3.5

Resources