Ionic 添加@capacitor/camera插件时显示PermissionState错误

t2a7ltrp  于 2022-12-16  发布在  Ionic
关注(0)|答案(1)|浏览(234)

我想从画廊上传照片,但使用@capacitor/core,它只会打开相机。而且,安装@capacitor/相机后显示此错误。

[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]                                     ~~~~~~~~~~~~~~~

这是我的package.json文件。

"@capacitor/android": "^2.0.1",
    "@capacitor/camera": "^1.3.1",
    "@capacitor/core": "2.0.1",
    "@capacitor/ios": "^2.0.1",
vc9ivgsu

vc9ivgsu1#

这是一个typescript错误,所以首先将typescript升级到最新版本。

npm install -g typescript@latest

然后检查版本

tsc -v

复制版本并在package.json中搜索typescript并粘贴版本.现在执行

npm install

相关问题