小编Sim*_*mon的帖子

错误:无法转换程序 - ionic2

我已经开发了一个应用程序6个月了.我从来没有在设备上测试它,总是在浏览器中,但它已经到了我想在我的Android手机上测试的地步.

所以我这样做ionic cordova run android --device,我得到一个错误:

错误:无法在新BuildError的BuildError.Error(native)上转换程序(C:\ xampp\htdocs\project x\projectx \node_modules\@ionic\app-scripts\dist\util\errors.js:16:28) at C:\ xampp\htdocs\project x\projectx \node_modules\@ionic\app-scripts\dist\transpile.js:159:20 at transpileWorker(C:\ xampp\htdocs\project x\projectx \node_modules\@ionic\app-scripts\dist\transpile.js:107:12)在Object.transpile(C:\ xampp\htdocs\project x\projectx \node_modules\@ionic\app-scripts\dist\transpile.js:64:12) )在C:\ xampp\htdocs\project x\projectx \node_modules\@ionic\app-scripts\dist\build.js:109:82 [18:05:02]复制完成4.95秒

这似乎无法解决.

我很好奇,如果它可能是我的机器,电话或其他东西的问题所以我创建了一个新的离子项目ionic start ionic-test,然后再次运行它ionic cordova run android --device,这次它完美地工作.它在我的设备上运行.

所以考虑到这一点,我可以简单地将我的src文件粘贴到新项目中吗?或者我还能做些什么才能让这个工作?有什么想法/提示吗?谢谢!

编辑:

这是一个完整结果的pastebin ionic cordova run android --device. https://pastebin.com/x1zX5U1e(注意:打字稿中有大约200个代码警告,但它们都是非常小的东西)

这是一个pastebin ionic info

https://pastebin.com/A628WpAW

编辑2:我找到了解决方案.我很快就会发布一个详细的答案!

cordova typescript ionic-framework ionic2

15
推荐指数
1
解决办法
4538
查看次数

在node-sass@4.7.2安装后脚本失败

我刚刚下载了最新版本的,node.js并且一直在尝试执行npm install我的一个项目,但是却说:

在node-sass@4.7.2安装后脚本失败。

我试着做:npm rebuild node-sass --force这也没做。

在此处输入图片说明

错误日志返回以下内容:

3209 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/common@^6.0.0 
but none is installed. You must install peer dependencies yourself.
3210 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself.
3211 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/platform-browser@^6.0.0 but none is installed. You must install peer dependencies yourself.
3212 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/platform-browser-dynamic@^6.0.0 but none is installed. …
Run Code Online (Sandbox Code Playgroud)

sass node.js npm node-sass

8
推荐指数
3
解决办法
9016
查看次数

离线执行失败,任务':app:transformClassesWithDesugarForRelease'

当我尝试在笔记本电脑和Ionic的Pro仪表板上构建Android时出现此错误.

[04:27:55]: ? FAILURE: Build failed with an exception.
[04:27:55]: ? * What went wrong:
[04:27:55]: ? Execution failed for task ':app:transformClassesWithDesugarForRelease'.
[04:27:55]: ? > com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments {--input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/43.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/45.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/49.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/51.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/37.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/39.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/3.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/5.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/28.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/30.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/47.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/49.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/19.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/21.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/44.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/46.jar --classpath_entry /builds/user/anonymous-social/platforms/android/CordovaLib/build/intermediates/intermediate-jars/release/classes.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/classes/release --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/0.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/1.jar …
Run Code Online (Sandbox Code Playgroud)

android cordova ionic-framework ionic2 ionic3

8
推荐指数
1
解决办法
997
查看次数

ionic/angular2 - 拒绝从'http:// localhost:8100/build/main.css'应用样式,因为它的MIME类型('text/html')不受支持

我的离子构建工作完美,直到我想在我的iPhone上测试,所以我停止了我的服务器,然后做了一个ionic serve --address localhost,我注意到我的样式表不再加载...所以我杀了服务器再次回到ionic serve和错误坚持..

(index):1拒绝从' http:// localhost:8100/build/main.css ' 应用样式,因为它的MIME类型('text/html')不是受支持的样式表MIME类型,并且启用了严格的MIME检查.

我已经尝试清除缓存localhost:8100并重建项目,但错误仍然存​​在......

有任何想法吗?我几乎被困住直到这个问题得到解决:(

编辑:我最终修复它的方式可能不是最好的..但至少它再次起作用.我刚进入我的github存储库,我的应用程序已下载main.css并粘贴到build文件夹中,因此我没有遇到任何问题.

javascript ionic-framework ionic2 angular

7
推荐指数
2
解决办法
8182
查看次数

Ionic 4路由器以编程方式销毁页面

我的应用程序上有一个注册流程。在每个步骤中,我不希望用户能够转到上一页,但是,ionic 使这些页面保持“活动”状态,并且用户可以通过从左向右滑动或使用后退按钮返回他们的电话。

我使用 ionic 的路由系统转换每个用户:

 this.router.navigateByUrl('/invite');
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

 this.router.navigate(['/invite']);
Run Code Online (Sandbox Code Playgroud)

和:

 this.router.navigateByUrl('/invite', { skipLocationChange: true });
Run Code Online (Sandbox Code Playgroud)

目前它给我带来了很多问题,我已经做了很多谷歌搜索,但找不到任何解决方案。

有没有办法使用 ionic 的路由器系统来销毁页面或禁止某些页面上的向后导航?任何建议都会很棒。谢谢。

ionic-framework angular angular-router ionic4

6
推荐指数
2
解决办法
9823
查看次数

是否有可能获得表情符号的多数颜色?

我想要实现的是添加一个text-shadow表情符号,text-shadow颜色是表情符号中最突出的颜色.

我知道有一些JavaScript库可以识别图像中最突出的颜色,但由于表情符号在技术上是文本,我不知道我是怎么做的,或者甚至根本不可能.

我会提供一些我已经尝试过的代码,但老实说,我甚至不知道从哪里开始.

.emoji {
  text-shadow: 0px 0px 20px rgba(54, 169, 230, 0.65);
  padding: 3px 6px;
  font-size: 24px;
}
Run Code Online (Sandbox Code Playgroud)
<span class="emoji"></span>
Run Code Online (Sandbox Code Playgroud)

javascript css shadow css3 emoji

5
推荐指数
2
解决办法
223
查看次数

Alternate color every 4 items

Is it possible with pure CSS to create a color grid that alternates every 4 items. Eg; First 4 items to have blue color, the next 4 to have red and then the next 4 back to blue and so on.

<div>Item 1 = blue</div>
<div>Item 2 = blue</div>
<div>Item 3 = blue</div>
<div>Item 4 = blue</div>
<div>Item 5 = red</div>
<div>Item 6 = red</div>
<div>Item 7 = red</div>
<div>Item 8 = red</div>
<div>Item 9 = blue</div>
Run Code Online (Sandbox Code Playgroud)

Any ideas? I …

html css css-selectors

4
推荐指数
1
解决办法
59
查看次数

ionic - 添加插件失败,因为它已经存在,删除插件失败,因为它不存在

我有一些如何设法搞砸我的 Ionic 项目......一些帮助将不胜感激。

我正在尝试添加,cordova-plugin-camera所以我正在做的是:

$ cordova plugin add cordova-plugin-camera 这将返回一个错误:

Installing "cordova-plugin-camera" for android
Android Studio project detected
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-camera': CordovaError: Uh oh!
"C:\xampp\htdocs\project x\anonymous-social\platforms\android\app\src\main\res\xml\camera_provider_paths.xml" already exists!
    at copyNewFile (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:261:45)
    at install (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:51:17)
    at ActionStack.process (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
    at PluginManager.doOperation (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:114:20)
    at PluginManager.addPlugin (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:144:17)
    at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\Api.js:247:74
    at _fulfilled (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:854:54)
    at self.promiseDispatch.done (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:883:30)
    at Promise.promise.promiseDispatch (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:816:13)
    at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:570:49
(node:26116) UnhandledPromiseRejectionWarning: CordovaError: …
Run Code Online (Sandbox Code Playgroud)

cordova ionic-framework cordova-plugins ionic2 ionic3

2
推荐指数
1
解决办法
4264
查看次数

无法读取未定义的属性"find"(UnhandledPromiseRejectionWarning)

我正在使用Angular/Firebase在Ionic中构建应用程序.

我想在我的Android设备上测试应用程序,以前已经完美运行了.但是,最近我因为收到错误而无法运行它.

$ ionic cordova run android --device --prod
Run Code Online (Sandbox Code Playgroud)

然后会导致错误:

Running app-scripts build: --prod --platform android --target cordova
[15:36:05]  build prod started ...
[15:36:05]  clean started ...
[15:36:05]  clean finished in 6 ms
[15:36:05]  copy started ...
[15:36:06]  deeplinks started ...
[15:36:06]  deeplinks finished in 270 ms
[15:36:06]  ngc started ...
[15:36:19]  ngc finished in 12.61 s
[15:36:19]  preprocess started ...
[15:36:19]  preprocess finished in 1 ms
[15:36:19]  webpack started ...
[15:36:19]  copy finished in 13.84 s
[15:37:27]  webpack finished …
Run Code Online (Sandbox Code Playgroud)

npm cordova ionic-framework cordova-plugins ionic2

2
推荐指数
1
解决办法
945
查看次数

打字稿错误 - 找不到名称“要求”

我正在用 Angular/Typescript 构建一个 Ionic 应用程序。

我正在使用一个名为的库emojiRegex,但我有点不确定如何使用它。

我是这样导入的:

import { emojiRegex } from 'emoji-regex';
Run Code Online (Sandbox Code Playgroud)

然后根据文档你必须这样require做吗?

所以我在做:

let emojiRegex = require('emoji-regex');
if(emojiRegex().test(this.emoji)) {
Run Code Online (Sandbox Code Playgroud)

哪个有效,但我收到一个打字稿错误,我想删除..

我读到你需要添加到你的 `tsconfig.json:

"types": [
  "node"
],
Run Code Online (Sandbox Code Playgroud)

然后运行npm install @types/node --save-dev我所做的,但它对我不起作用。我刚刚收到另一个错误,指出:

[10:39:24] 打字稿错误找不到“节点”的类型定义文件。

那么我有什么想法可以做到这一点吗?我觉得我错过了一些非常简单的东西..谢谢!

javascript typescript ionic-framework angular

1
推荐指数
1
解决办法
3341
查看次数

图像高度与宽度相同

我在容器内有一个图像,我希望它是一个完美的正方形。我将宽度设置为容器的100%,目标是height使图像的宽度与宽度相同,因为我不知道由于响应式设计,容器的尺寸将是多少。

有任何想法吗?我正在使用sass,如果有帮助的话。

.container {
width: 50%;
}

.container img {
  width: 100%;
  height: 400px; //this should be the same as the width value..
}
Run Code Online (Sandbox Code Playgroud)
<div class="container"><img src="https://images.pexels.com/photos/1249588/pexels-photo-1249588.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"/></div>
Run Code Online (Sandbox Code Playgroud)

最好没有javascript解决方案,但也许不可能做到这一点?

html css sass

1
推荐指数
1
解决办法
3688
查看次数