我的项目最初是使用:
构建的ionic: 2.0.0-rc.3
ionic-app-scripts: 0.0.45
升级到:
ionic: 2.0.0
(看起来像2.0.0-rc.6
) ionic-app-scripts: 1.0.0
我遇到了很多错误:
我已经审核了ionic
changelog和ionic-app-scripts
one,但没有突出显示。
我假设错误与ionic-app-scripts
(因为它是node_modules
中的目录)有关,但是我不知道它可能是什么
运行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
修改
这是我的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"
},
编辑#2:
如果我将packages.json
从工作模板复制到我的项目(并重新安装node_modules
),我会收到与以前相同的错误。 @ionic/app-scripts
显然是错误的,因为我已经运行了npm run build
(如所述here),而这正是出现错误的地方。
由于错误仅在我复制到src
文件夹时出现,因此它必须与我的项目相关,因为它是用0.0.45
编写的,而不是1.0.0
的{ {1}}。有没有可能的方法来调试并找到错误的位置?
另外(即使开箱即用的模板有效),进入@ionic/app-scripts
和clean-css-factory.d.ts
时,即使构建并运行正常,也会出现相同的错误?
注意:运行virtual-file-utils.d.ts
时,控制台会一直登录,直到:
npm run build
SOLUTION:
我找到了原始问题的解决方案。有一个未使用的模块已导致不再存在(由于新版本的> 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**
),它是:
@ionic/app-scripts
答案 0 :(得分:0)
您是否尝试过删除节点模块?
rm -rf node_modules
你有最新的cli吗?
npm uninstall -g ionic
npm install -g ionic
将package.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"
}
作为最后的手段,您可以创建一个新的离子应用程序,然后移动所有代码
ionic start newApp --v2 --ts
答案 1 :(得分:0)
解决方案是我有一个未使用的导入,正在寻找@ionic/app-scripts
中不再存在的模块(来自0.0.45
并且不存在于1.0.0
中)。
它所寻找的模块是transformSrcPathToTmpPath
@ionic/app-scripts/dist