升级到ionic v2.0.0问题

时间:2023-02-05 23:00:59

My project was originally built using:

我的项目最初是用:

  • ionic: 2.0.0-rc.3
  • 离子:2.0.0-rc.3
  • ionic-app-scripts: 0.0.45
  • ionic-app-scripts:0.0.45

After upgrading to:

升级后:

  • ionic: 2.0.0 (which just looks like 2.0.0-rc.6)
  • ionic: 2.0.0(如图2.0.0-rc.6所示)
  • ionic-app-scripts: 1.0.0
  • ionic-app-scripts:1.0.0

I'm encountering lots of errors:

我遇到了很多错误:

升级到ionic v2.0.0问题

I've reviewed the ionic changelog and the ionic-app-scripts one but nothing stands out.

我已经看过了ionic changelog和ionic-app-scripts一个但没有什么特别的。

I'm assuming the errors are to do with ionic-app-scripts (as that's the directory in node_modules) it's looking at but I'm not sure what it could be.

我假设错误与ionic-app-scripts(因为它是node_modules中的目录)有关,但我不确定它可能是什么。

When running ionic info:

运行时离子信息:

Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.4.0
Xcode version: Not installed

EDIT:

编辑:

This is my package.json:

这是我package.json:

"dependencies": {
    "@angular/common": "2.4.5",
    "@angular/compiler": "2.4.5",
    "@angular/compiler-cli": "2.4.5",
    "@angular/core": "2.4.5",
    "@angular/forms": "2.4.5",
    "@angular/http": "2.4.5",
    "@angular/platform-browser": "2.4.5",
    "@angular/platform-browser-dynamic": "2.4.5",
    "@angular/platform-server": "2.4.5",
    "@ionic/storage": "1.1.7",
    "@types/jasmine": "^2.5.40",
    "@types/lodash": "^4.14.50",
    "angular2-google-maps": "0.17.0",
    "angularfire2": "^2.0.0-beta.6",
    "clean-css": "^4.0.2",
    "firebase": "^3.6.4",
    "ionic-angular": "2.0.0",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "lodash": "^4.17.4",
    "rxjs": "^5.0.0-beta.12",
    "zone.js": "0.7.6"
},
"devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.1.5"
},

EDIT #2:

编辑# 2:

If I copy the packages.json from a working template to my project (and do a fresh install of node_modules) I get the same error as before. It is clearly an error with @ionic/app-scripts as I have run npm run build (as described here) and that's where the error(s) appear.

如果我复制包裹。从一个工作模板到我的项目(并重新安装node_modules),我得到了与以前相同的错误。这显然是@ionic/app-scripts的错误,因为我已经运行了npm运行构建(如这里所描述的),这就是错误出现的地方。

Since the error(s) only came when I copied in my src folder, it must be something to with my project as it was written with 0.0.45 and not 1.0.0 of @ionic/app-scripts. Is there a possible way to debug and find where the error is?

由于错误是在我的src文件夹中复制时才出现的,所以一定与我的项目有关,因为它是用0.0.0.45而不是1.0.0的@ionic/app-scripts来编写的。有没有一种方法可以调试并找出错误在哪里?

Also (even though the out-the-box template works), when going into clean-css-factory.d.ts and virtual-file-utils.d.ts, the same errors are there even though it builds and runs just fine?

同样(即使out-the- the-box模板可以工作),在进入clean-css-factory.d时。ts和virtual-file-utils.d。ts,即使构建和运行良好,也有相同的错误吗?

Note: When running npm run build, the console logs up until:

注意:在运行npm运行构建时,控制台将记录到:

> ionic-hello-world@ build   E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2
> ionic-app-scripts build

[15:41:38]  ionic-app-scripts 1.0.0
[15:41:38]  build dev started ...
[15:41:38]  clean started ...
[15:41:38]  clean finished in 3 ms
[15:41:38]  copy started ...
[15:41:38]  transpile started ...

            **errors occur from here**

SOLUTION:

解决方案:

I have found a solution to the original problem. There was an unused import of a module that no longer exists (due to the new version of @ionic/app-scripts) which was:

我找到了解决原来问题的办法。有一个未使用的模块的导入已经不再存在(由于新版本的@ionic/app-scripts):

import { transformSrcPathToTmpPath } from "@ionic/app-scripts/dist";

从“@ionic/app-scripts/dist”导入{transformSrcPathToTmpPath};

2 个解决方案

#1


0  

Have you tried Deleting node Modules ?

是否尝试过删除节点模块?

rm -rf node_modules

Do you have the latest cli ?

你有最新的cli吗?

npm uninstall -g ionic
npm install -g ionic

Change your package.json to the following

改变你的计划。json如下

"dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "ionic-angular": "2.0.0-rc.5",
    "ionic-native": "2.2.11",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26",
    "sw-toolbox": "3.4.0"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.0.9"
  }

As a last resort you can create a new ionic application then move all your code

最后,您可以创建一个新的ionic应用程序,然后移动所有代码

ionic start newApp --v2 --ts

#2


0  

The solution was that I had an unused import looking for a module in @ionic/app-scripts that no longer existed (was from 0.0.45 and doesn't exist in 1.0.0).
The module it was looking for was transformSrcPathToTmpPath in @ionic/app-scripts/dist

解决方案是,我有一个未使用的导入在@ionic/app-scripts中寻找一个不再存在的模块(从0.0.0.45开始,在1.0.0中不存在)。它正在寻找的模块是transformSrcPathToTmpPath在@ionic/app-scripts/dist

#1


0  

Have you tried Deleting node Modules ?

是否尝试过删除节点模块?

rm -rf node_modules

Do you have the latest cli ?

你有最新的cli吗?

npm uninstall -g ionic
npm install -g ionic

Change your package.json to the following

改变你的计划。json如下

"dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "ionic-angular": "2.0.0-rc.5",
    "ionic-native": "2.2.11",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26",
    "sw-toolbox": "3.4.0"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.0.9"
  }

As a last resort you can create a new ionic application then move all your code

最后,您可以创建一个新的ionic应用程序,然后移动所有代码

ionic start newApp --v2 --ts

#2


0  

The solution was that I had an unused import looking for a module in @ionic/app-scripts that no longer existed (was from 0.0.45 and doesn't exist in 1.0.0).
The module it was looking for was transformSrcPathToTmpPath in @ionic/app-scripts/dist

解决方案是,我有一个未使用的导入在@ionic/app-scripts中寻找一个不再存在的模块(从0.0.0.45开始,在1.0.0中不存在)。它正在寻找的模块是transformSrcPathToTmpPath在@ionic/app-scripts/dist