Showing PermissionState error while adding #capacitor/camera plugin - ionic-framework

I want to upload photos from the gallery but using #capacitor/core, it will open camera only. And, showing this error after installing #capacitor/camera.
[ng] ERROR in node_modules/#capacitor/camera/dist/esm/definitions.d.ts:1:13 - error TS1005: '=' expected.
[ng] 1 import type { PermissionState } from '#capacitor/core';
[ng] ~
[ng] node_modules/#capacitor/camera/dist/esm/definitions.d.ts:1:38 - error TS1005: ';' expected.
[ng] 1 import type { PermissionState } from '#capacitor/core';
[ng] ~~~~~~~~~~~~~~~~~
[ng] node_modules/#capacitor/camera/dist/esm/index.d.ts:1:13 - error TS1005: '=' expected.
[ng] 1 import type { CameraPlugin } from './definitions';
[ng] ~
[ng] node_modules/#capacitor/camera/dist/esm/index.d.ts:1:35 - error TS1005: ';' expected.
[ng] 1 import type { CameraPlugin } from './definitions';
[ng] ~~~~~~~~~~~~~~~
Here is my package.json file.
"#capacitor/android": "^2.0.1",
"#capacitor/camera": "^1.3.1",
"#capacitor/core": "2.0.1",
"#capacitor/ios": "^2.0.1",

Its a typescript error so first upgrade typescipt to latest version.
run
npm install -g typescript#latest
and then check version
tsc -v
copy the version and search typescript in package.json and paste the version.
now do
npm install

Related

Error: 'TextInputControl' flutter zefyrka package

i get this error
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
../../../development/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/zefyrka-1.4.0/lib/src/widgets/editor.dart:1321:7: Error: Type 'TextInputControl' not found.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
../../../development/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/zefyrka-1.4.0/lib/src/widgets/editor.dart:1321:37: Error: Type 'TextInputControl' not found.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
../../../development/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/zefyrka-1.4.0/lib/src/widgets/editor.dart:1321:7: Error: 'TextInputControl' isn't a type.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
../../../development/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/zefyrka-1.4.0/lib/src/widgets/editor.dart:1321:37: Error: 'TextInputControl' isn't a type.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
and this happens after remove the zefrka package and reuse it
what is problem?

I got Too few positional arguments error flutter and I can't understand why?

Hi everyone my app was work will before two to days today when I run my app it gives me that following error :
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.0+1/lib/src/bottom_sheet.dart:295:43: Error: Too few positional arguments: 1 required, 0 given.
_velocityTracker = VelocityTracker();
^
/C:/src/flutter/packages/flutter/lib/src/gestures/velocity_tracker.dart:152:3: Context: Found this candidate, but the arguments don't match.
VelocityTracker(this.kind);
^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/fade_scale_transition.dart:148:29: Error: 'decelerateEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: decelerateEasing));
^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:315:12: Error: 'decelerateEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
curve: decelerateEasing,
^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:321:29: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:326:29: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:335:35: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:355:35: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:402:12: Error: 'accelerateEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
curve: accelerateEasing,
^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:408:29: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:413:29: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:422:35: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animations-1.1.1/lib/src/shared_axis_transition.dart:445:35: Error: 'standardEasing' is imported from both 'package:flutter/src/material/curves.dart' and 'package:animations/src/utils/curves.dart'.
).chain(CurveTween(curve: standardEasing));
^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 27s
Exception: Gradle task assembleDebug failed with exit code 1
I don't understand why this error is appear and how I fixed It .
any suggestions will appreciated
Open this file which is giving error:
C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.0+1/lib/src/bottom_sheet.dart:295:43:
At line 295 fix the error by changing:
_velocityTracker = VelocityTracker();
into
_velocityTracker = VelocityTracker(PointerDeviceKind.touch);
This is a temporary work around. The issue will be fixed in next beta release.
I had a similiar error after I updated my flutter version to 3.0.0. I updated the modal_bottom_sheet package in the pubspec.yaml file from 2.0.0 to 2.0.1. After this it worked for me also with flutter version 3.0.0.
modal_bottom_sheet: ^2.0.1
Don't forget to run pub get after the upgrade to the new version.
I was missing this in my pubspec.yaml file, so i just added:
modal_bottom_sheet: ^2.0.1
ran on terminal after:
flutter pub get
and we good to go...

Flutter: I get an error when running the official document unit test sample

https://flutter.dev/docs/cookbook/testing/unit/introduction
I am trying to run the unit test sample on the above page as is,
When I run it, I get an error.
flu_basic/
lib/
main.dart
test/
counter_test.dart
//main.dart
class Counter {
int value = 0;
void increment() => value++;
void decrement() => value--;
}
//counter_test.dart
import 'package:test/test.dart';
import 'package:flu_basic/main.dart';
void main() {
group('Counter🐭', () {
test('value should start at 0', () {
expect(Counter().value, 0);
});
test('value should be incremented♉️', () {
final counter = Counter();
counter.increment();
expect(counter.value, 1);
});
test('value should be decremented🐯', () {
final counter = Counter();
counter.decrement();
expect(counter.value, -1);
});
});
}
//part of dev_dependencies of pubspec.yaml file
dev_dependencies:
test: ^1.15.3
When I run the following in terminal
flutter test test/counter_test.dart
Running "flutter pub get" in flu_basic... 0.6s
00:00 +0: loading /Users/userno1/dev2/flu_basic/test/counter_test.dart
Error: cannot run without a dependency on "package:flutter_test". Ensure the following lines are present in your
pubspec.yaml:
dev_dependencies:
flutter_test:
sdk: flutter
00:00 +0 -1: loading /Users/userno1/dev2/flu_basic/test/counter_test.dart [E]
Failed to load "/Users/userno1/dev2/flu_basic/test/counter_test.dart":
Compilation failed
Test: /Users/userno1/dev2/flu_basic/test/counter_test.dart
Shell: /Users/userno1/dev2/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
00:00 +0 -1: Some tests failed.
I get the above error.
part of dev_dependencies of pubspec.yaml file like below↓
dev_dependencies:
#test: ^1.15.3 ←comment out
flutter_test:
sdk: flutter
00:00 +0: loading /Users/userno1/dev2/flu_basic/test/counter_test.dart Error: Could not resolve the package 'test' in 'package:test/test.dart'.
test/counter_test.dart:4:8: Error: Not found: 'package:test/test.dart'
import 'package:test/test.dart';
^
00:02 +0: loading /Users/userno1/dev2/flu_basic/test/counter_test.dart test/counter_test.dart:10:7: Error: Method not found: 'expect'.
expect(Counter().value, 0);
^^^^^^
test/counter_test.dart:9:5: Error: Method not found: 'test'.
test('value should start at 0', () {
^^^^
test/counter_test.dart:18:7: Error: Method not found: 'expect'.
expect(counter.value, 1);
^^^^^^
test/counter_test.dart:13:5: Error: Method not found: 'test'.
test('value should be incremented♉️', () {
^^^^
test/counter_test.dart:26:7: Error: Method not found: 'expect'.
expect(counter.value, -1);
^^^^^^
test/counter_test.dart:21:5: Error: Method not found: 'test'.
test('value should be decremented🐯', () {
^^^^
test/counter_test.dart:8:3: Error: Method not found: 'group'.
group('Counter🐭', () {
^^^^^
00:06 +0 -1: loading /Users/userno1/dev2/flu_basic/test/counter_test.dart [E]
Failed to load "/Users/userno1/dev2/flu_basic/test/counter_test.dart":
Compilation failed
Test: /Users/userno1/dev2/flu_basic/test/counter_test.dart
Shell: /Users/userno1/dev2/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
00:06 +0 -1: Some tests failed.
I get the above error.
Maybe on the page above
1.Add the test dependency
I think it's a problem with the part, but I don't know what to do.
What's wrong?
You should only use the test package If you’re working on a Dart package that does not depend on Flutter. From the look of it, your project requires flutter so rather than the dev dependencies you're using at the moment, you should use the following
dev_dependencies:
flutter_test:
sdk: flutter
and import the flutter_test package
import 'package:flutter_test/flutter_test.dart';

How to create a multi-apps project in Ionic 4?

I try to create a simple multi-apps project in Ionic 4, following the ionic documentation, but it doesn't work.
https://ionicframework.com/docs/cli/configuration#multi-app-projects
My config :
Ionic : v4.12.0
Angular CLI : 7.3.8
Node : 10.15.1
npm : 6.9.0
Windows 10
What I have done :
I have created a directory “monorepo”.
In this folder, I created a file ionic.config.json and pasted in it the code below:
{
"projects": {}
}
In monorepo, I create a second directory : apps.
In this directory (with the command prompt), I write the command :
ionic start "app1" --no-deps
monorepo/ionic.config.json is correctly populated with the data:
{
"projects": {
"app1": {
"name": "app1",
"integrations": {},
"type": "angular",
"root": "apps\\app1"
}
}
}
But when I try to serve the server, it won't work.
ionic serve --project app1 return me this error message :
> ng run app1:serve --host=0.0.0.0 --port=8100
[ng] Project 'app1' could not be found in workspace.
[ng] Error: Project 'app1' could not be found in workspace.
[ng] at Workspace.getProject (C:\Users\name\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\#angular-devkit\core\src\workspace\workspace.js:93:19)
[ng] at Architect.getBuilderConfiguration (C:\Users\name\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\#angular-devkit\architect\src\architect-legacy.js:117:41)
[ng] at RunCommand.runSingleTarget (C:\Users\name\AppData\Roaming\npm\node_modules\#angular\cli\models\architect-command.js:160:45)
[ng] at RunCommand.runArchitectTarget (C:\Users\name\AppData\Roaming\npm\node_modules\#angular\cli\models\architect-command.js:201:35)
[ng] at RunCommand.run (C:\Users\name\AppData\Roaming\npm\node_modules\#angular\cli\commands\run-impl.js:14:25)
[ng] at RunCommand.validateAndRun (C:\Users\name\AppData\Roaming\npm\node_modules\#angular\cli\models\command.js:124:31)
[ng] at process._tickCallback (internal/process/next_tick.js:68:7)
[ng] at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
[ng] at startup (internal/bootstrap/node.js:283:19)
[ng] at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
When I go under the file associated with the error (workspace.js:93:19), and I do console.log, I obtain this info:
getProject(projectName) {
this._assertLoaded();
console.log("this.projectName : " + projectName); // this.projectName : app1
console.log("\n\nthis._workspace.projects : \n");
console.log(this._workspace.projects); // this._workspace.projects : app and app-e2e
const workspaceProject = this._workspace.projects[projectName];
(Values displayed are in comments).
The projectName variable seems ok. But the available project in this._workspace.projects are app and app-e2e which seem weird.
What is my problem ?
What did I miss ?
I managed to compile by replacing in the angular.json every app keyword by the name of my ionic project (here, app1).
{
"$schema": "./node_modules/#angular-devkit/core/src/workspace/workspace-schema.json",
"version": 1,
"defaultProject": "app1", <-- HERE
"newProjectRoot": "projects",
"projects": {
"app1": { <-- HERE
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app1", <-- NOT MANDATORY
"schematics": {},
"architect": {
"build": { ... },
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app1:build" <-- HERE
},
...
}
I suppose that instead of putting several angular apps within one project structure you should rewrite each ionic project's angular.json

(babel plugin) Error: .sourceMap must be a boolean, "inline", "both", or undefined

When attempting to package a nuxt component, I get the above error. I am running nuxt 2.4.5, #babel/core 7.0.0 and rollup 1.4.0.
Does anyone have any thoughts?
Thanks in advance..
npm run script:
"build:es": "rollup --config build/rollup.config.js --format es --file dist/cxl-nuxt-map.esm.js"
Command :
nr build:es
cxl-nuxt-map#1.0.0 build:es /Users/userinfo/Projects/cxl-nuxt-map rollup --config build/rollup.config.js --format es --file dist/cxl-nuxt-map.esm.js
index.js → dist/cxl-nuxt-map.esm.js...
Stack Trace:
[!] (babel plugin) Error: .sourceMap must be a boolean, "inline", "both", or undefined
index.js
Error: .sourceMap must be a boolean, "inline", "both", or undefined
at assertSourceMaps (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/validation/option-assertions.js:65:11)
at Object.keys.forEach.key (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/validation/options.js:107:5)
at Array.forEach (<anonymous>)
at validateNested (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/validation/options.js:83:21)
at validate (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/validation/options.js:74:10)
at file (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/config-chain.js:174:34)
at cachedFunction (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/caching.js:33:19)
at buildRootChain (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/config-chain.js:120:36)
at loadPrivatePartialConfig (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/partial.js:85:55)
at Object.loadPartialConfig (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/#babel/core/lib/config/partial.js:110:18)
at Object.babel.loadPartialConfig (/Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/rollup-plugin-babel/src/index.js:80:20)
at /Users/dan.mahoney/Projects/cxl-nuxt-map/node_modules/rollup/dist/rollup.js:17051:25
at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:47:5)
at Function.Module.runMain (internal/modules/cjs/loader.js:804:11)
at internal/main/run_main_module.js:21:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cxl-nuxt-map#1.0.0 build:es: `rollup --config build/rollup.config.js --format es --file dist/cxl-nuxt-map.esm.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cxl-nuxt-map#1.0.0 build:es script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dan.mahoney/.npm/_logs/2019-03-01T20_10_17_889Z-debug.log
Rollup.config.js:
/* rollup.config.js */
import vue from 'rollup-plugin-vue';
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import replace from 'rollup-plugin-replace';
import { plugin as analyze } from 'rollup-plugin-analyzer';
export default {
input: 'index.js',
output: {
name: 'CxlNuxtMap',
exports: 'named',
},
plugins: [
postcss({
extensions: ['.css'],
runtimeHelpers: true,
exclude: 'node_modules/**',
}),
vue(),
babel({
exclude: 'node_modules/**',
}),
replace({
'process.env.INCLUDE_DEPS': JSON.stringify('false'),
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
commonjs({
namedExports: {},
}),
analyze({ stdout: true }),
],
};
Found in the problem in my .babelrc file. The offending line was:
"sourceMap": "true",
should be:
"sourceMaps": true,