Mirgation Issue: 6.5 > 8.5 | Launch fails: 'env' not defined
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- android, javascript, webpack
- 領域
- build-system, mobile
調査の方向性
まず、提供された NativeScript バージョンで Android の起動失敗を再現し、カスタム webpack 設定、特に NodePolyfillPlugin の設定を調査します。報告されたパスを node_modules/util/util.js、webpack/bootstrap、console-browserify、@nativescript/core の順にたどります。完了とは、ビルドされたアプリケーションが undefined env exception なしで起動することです。
索引モデルが issue の本文から書いたものです。
説明
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 8.5.7
- Cross-platform modules:
- Android Runtime: 8.5.0
- iOS Runtime (if applicable):
- Plugin(s):
Describe the bug
The project builds successfully, but crashes on launch with this error:
"An uncaught Exception occurred on "main" thread.
Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
TypeError: Cannot read properties of undefined (reading 'env')
File: (file: app/webpack:/com.app.game/webpack/bootstrap:27:0)"
StackTrace:
./node_modules/util/util.js(file: app/webpack:/com.app.game/node_modules/util/util.js:109:11)
at webpack_require(file: app/webpack:/com.app.game/webpack/bootstrap:24:0)
at fn(file: app/webpack:/com.app.game/webpack/runtime/hot module replacement:62:0)
at ./node_modules/console-browserify/index.js(file: app/webpack:/com.app.game/node_modules/console-browserify/index.js:2:11)
at webpack_require(file: app/webpack:/com.app.game/webpack/bootstrap:24:0)
at fn(file: app/webpack:/com.app.game/webpack/runtime/hot module replacement:62:0)
at ./node_modules/@nativescript/core/data/observable/index.js(file:///data/data/com.app.game/files/app/vendor.js:6780:41)
at webpack_require(file: app/webpack:/com.app.game/webpack/bootstrap:24:0)
at fn(file: app/webpack:/com.app.game/webpack/runtime/hot module replacement:62:0)
at ./node_modules/@nativescript/core/globals/index.js(file:///data/data/com.app.game/files/app/vendor.js:10525:74)
at webpack_require(file: app/webpack:/com.app.game/webpack/bootstrap:24:0)
at webpack_exec(file:///data/data/com.app.game/files/app/bundle.js:29616:39)
at (file:///data/data/com.app.game/files/app/bundle.js:29617:71)
at webpack_require.X(file: app/webpack:/com.app.game/webpack/runtime/startup entrypoint:6:0)
at (file:///data/data/com.app.game/files/app/bundle.js:29617:47)
at (file:///data/data/com.app.game/files/app/bundle.js:29622:3)
at require(:1:266)
Package.json
{
"name": "com.app.game",
"version": "1.0.0",
"description": "NativeScript vue client",
"author": "test",
"license": "MIT",
"nativescript": {
"id": "com.app.game"
},
"dependencies": {
"@nativescript/core": "~8.5.0",
"@nativescript/payments": "^1.0.6",
"@nativescript/theme": "~3.0.2",
"axios": "^0.21.1",
"nativescript-numeric-keyboard": "~5.0.2",
"nativescript-signalr-core": "^2.0.0",
"nativescript-theme-core": "^2.0.24",
"nativescript-ui-chart": "~15.2.3",
"nativescript-ui-core": "~15.2.3",
"nativescript-ui-listview": "~15.2.3",
"nativescript-ui-sidedrawer": "~15.2.3",
"nativescript-vue": "^2.6.4",
"nativescript-websockets": "~2.0.0",
"next": "^13.4.7",
"node-polyfill-webpack-plugin": "^2.0.1",
"sass": "~1.49.9",
"vuex": "^3.3.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@nativescript/android": "^8.5.0",
"babel-loader": "^8.1.0",
"nativescript-vue-template-compiler": "^2.6.0",
"sass": "~1.49.9",
"vue-loader": "^15.9.1",
"@nativescript/webpack": "~5.0.0"
},
"main": "./app/main.js"
}
WebPack
const webpack = require("@nativescript/webpack");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin")
module.exports = (env) => {
webpack.init(env);
webpack.chainWebpack(config => {
// we add the plugin
config.plugin('node-polyfill-webpack-plugin').use(NodePolyfillPlugin)
})
return webpack.resolveConfig()
};
Additional context
- I know axios and a couple of other packages are not up to date and use the util.js which could be where the issue is. However, I removed those packages & references to them which resulted in the same error.
- I also added the polyfill package in webpack config so I don't think it is a polyfill issue?
- I have looked at SO questions, reported issues, etc. without any progress. Any help would be appreciated.
- 主要言語
- C++
- スター
- 563
- フォーク
- 144
- 平均マージ
- 10時間 46分
- マージ済み PR(30日)
- 14
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NativeScript/android のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
NativeScript/android#2039 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
NativeScript/android#2024 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
NativeScript/android#2020 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
NativeScript/android#2019 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
NativeScript/android#1986 ·
NativeScript/android の issue をすべて見る
似ている issue
-
AuTest Bug Tests
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#13714 ·
-
bug build
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
facebookincubator/velox#19143 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tenstorrent/tt-metal#57393 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
objectionary/eo-graphs#74 ·