将 NativeScript 6.5.1 更新到 8.2:从本机脚本 6.5.1 迁移到本机脚本 8.2 时出现构建错误
Updating NativeScript 6.5.1 to 8.2 : build errors when migrating from native script 6.5.1 to native script 8.2
When i do the build "tns debug ios --env.aot" i get below build errors
./node_modules/nativescript-orientation/orientation.js 中的错误 16:11-51
找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/core/view'
./node_modules/nativescript-orientation/orientation.js 中的错误 17:15-60
找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/core/view-base'
./node_modules/nativescript-orientation/orientation.js 中的错误 18:12-48
找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/enums'
./node_modules/nativescript-orientation/orientation.js 中的错误 19:12-48
找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/frame'
./node_modules/nativescript-orientation/orientation.js 中的错误 20:11-51
找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/page'
我认为这些错误是由于软件包过时造成的,还是我遗漏了什么?
"nativescript-orientation": "2.2.5"
这是orientation.js
在 nativescript 8.2 中,所有内容都移至 @nativescript/core,并且没有 tns-core-modules。
知道如何使用本机脚本新版本进行这项工作吗?
Package.json
{
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"@angular/animations": "~13.2.0",
"@angular/common": "~13.2.0",
"@angular/compiler": "~13.2.0",
"@angular/core": "~13.2.0",
"@angular/forms": "~13.2.0",
"@angular/http": "8.0.0-beta.10",
"@angular/platform-browser": "~13.2.0",
"@angular/platform-browser-dynamic": "~13.2.0",
"@angular/router": "~13.2.0",
"base-64": "^0.1.0",
"cross-env": "^5.2.0",
"lodash": "^4.17.11",
"nativescript-appversion": "1.4.4",
"@nativescript/camera": "5.0.10",
"nativescript-couchbase": "1.0.18",
"@nativescript/email": "2.0.5",
"@nativescript/geolocation": "8.0.2",
"nativescript-orientation": "2.2.5",
"nativescript-phone": "3.0.3",
"nativescript-screen-orientation": "2.0.0",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.13",
"rxjs": "~7.5.0",
"rxjs-compat": "^6.4.0",
"utf8": "^3.0.0",
"zone.js": "~0.11.5",
"@nativescript/core": "~8.2.0",
"@nativescript/angular": "^13.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.2.0",
"@angular/compiler-cli": "~13.2.0",
"@nativescript/ios": "8.2.1",
"@nativescript/schematics": "~0.5.0",
"@nativescript/types": "~8.2.0",
"@nativescript/webpack": "5.0.6",
"@ngtools/webpack": "~13.2.0",
"typescript": "~4.5.5"
},
"readme": "NativeScript Application",
"main": "./src/main.ts"
}
tsconfig.json
{
"compilerOptions": {
"module": "esnext",
"target": "es2017",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"lib": [
"dom",
"es2017"
],
"baseUrl": ".",
"paths": {
"~/*": ["src/*"],
"@/*": ["src/*"]
},
"moduleResolution": "node",
"removeComments": false
},
"include": [ "src/**/*.ios.ts"],
"files": ["./src/main.ts", "./reference.d.ts"],
"exclude": [
"node_modules",
"platforms"
]
}
webpack.config.js
const webpack = require("@nativescript/webpack");
module.exports = (env) => {
webpack.init(env);
return webpack.resolveConfig();
};
我通过删除第三方插件并像这样设置来修复它
UIDevice.currentDevice.setValueForKey(currentOrientation, "orientation");
When i do the build "tns debug ios --env.aot" i get below build errors
./node_modules/nativescript-orientation/orientation.js 中的错误 16:11-51 找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/core/view'./node_modules/nativescript-orientation/orientation.js 中的错误 17:15-60 找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/core/view-base'./node_modules/nativescript-orientation/orientation.js 中的错误 18:12-48 找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/enums'./node_modules/nativescript-orientation/orientation.js 中的错误 19:12-48 找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/frame'./node_modules/nativescript-orientation/orientation.js 中的错误 20:11-51 找不到模块:错误:无法解析“/Users/admin/project/node_modules/nativescript-orientation”
中的 'tns-core-modules/ui/page'我认为这些错误是由于软件包过时造成的,还是我遗漏了什么?
"nativescript-orientation": "2.2.5"
这是orientation.js
在 nativescript 8.2 中,所有内容都移至 @nativescript/core,并且没有 tns-core-modules。 知道如何使用本机脚本新版本进行这项工作吗?
Package.json
{
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"@angular/animations": "~13.2.0",
"@angular/common": "~13.2.0",
"@angular/compiler": "~13.2.0",
"@angular/core": "~13.2.0",
"@angular/forms": "~13.2.0",
"@angular/http": "8.0.0-beta.10",
"@angular/platform-browser": "~13.2.0",
"@angular/platform-browser-dynamic": "~13.2.0",
"@angular/router": "~13.2.0",
"base-64": "^0.1.0",
"cross-env": "^5.2.0",
"lodash": "^4.17.11",
"nativescript-appversion": "1.4.4",
"@nativescript/camera": "5.0.10",
"nativescript-couchbase": "1.0.18",
"@nativescript/email": "2.0.5",
"@nativescript/geolocation": "8.0.2",
"nativescript-orientation": "2.2.5",
"nativescript-phone": "3.0.3",
"nativescript-screen-orientation": "2.0.0",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.13",
"rxjs": "~7.5.0",
"rxjs-compat": "^6.4.0",
"utf8": "^3.0.0",
"zone.js": "~0.11.5",
"@nativescript/core": "~8.2.0",
"@nativescript/angular": "^13.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.2.0",
"@angular/compiler-cli": "~13.2.0",
"@nativescript/ios": "8.2.1",
"@nativescript/schematics": "~0.5.0",
"@nativescript/types": "~8.2.0",
"@nativescript/webpack": "5.0.6",
"@ngtools/webpack": "~13.2.0",
"typescript": "~4.5.5"
},
"readme": "NativeScript Application",
"main": "./src/main.ts"
}
tsconfig.json
{
"compilerOptions": {
"module": "esnext",
"target": "es2017",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"lib": [
"dom",
"es2017"
],
"baseUrl": ".",
"paths": {
"~/*": ["src/*"],
"@/*": ["src/*"]
},
"moduleResolution": "node",
"removeComments": false
},
"include": [ "src/**/*.ios.ts"],
"files": ["./src/main.ts", "./reference.d.ts"],
"exclude": [
"node_modules",
"platforms"
]
}
webpack.config.js
const webpack = require("@nativescript/webpack");
module.exports = (env) => {
webpack.init(env);
return webpack.resolveConfig();
};
我通过删除第三方插件并像这样设置来修复它
UIDevice.currentDevice.setValueForKey(currentOrientation, "orientation");