Skip to content

Android run fails #5724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
MeroVinggen opened this issue Mar 26, 2023 · 7 comments
Closed
3 tasks done

Android run fails #5724

MeroVinggen opened this issue Mar 26, 2023 · 7 comments
Labels
bug-pending-triage Reported bug, pending triage to confirm.

Comments

@MeroVinggen
Copy link

MeroVinggen commented Mar 26, 2023

Issue Description

When I want to start my app at android platform on Winows 10 it fails on webpack build: "Cannot find module 'jsonfile/utils'".

Full error message:

Searching for devices...
Preparing project...
Error: Cannot find module 'jsonfile/utils'
Require stack:

  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\node_modules\fs-extra\lib\json\output-json.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\node_modules\fs-extra\lib\json\index.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\node_modules\fs-extra\lib\index.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\node_modules\streamroller\lib\RollingFileWriteStream.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\node_modules\streamroller\lib\index.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\[email protected]\node_modules\log4js\lib\appenders\file.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\[email protected]\node_modules\log4js\lib\appenders\index.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\[email protected]\node_modules\log4js\lib\log4js.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\[email protected]\node_modules\nativescript\lib\common\logger\logger.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\[email protected]\node_modules\nativescript\lib\common\yok.js
  • C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\[email protected]\node_modules\nativescript\lib\nativescript-cli-lib.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\helpers\config.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\helpers\platform.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\helpers\copyRules.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\helpers\fileReplacements.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\configuration\base.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\configuration\index.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\index.js
  • C:\Users\Admin\Desktop\myCoolApp2\webpack.config.js
  • C:\Users\Admin\Desktop\myCoolApp2\node_modules@nativescript\webpack\dist\bin\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\node_modules\fs-extra\lib\json\output-json.js:3:23)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Admin\AppData\Local\pnpm\global\5.pnpm\node_modules\fs-extra\lib\json\index.js:6:25)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\node_modules\fs-extra\lib\json\output-json.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\node_modules\fs-extra\lib\json\index.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\node_modules\fs-extra\lib\index.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\node_modules\streamroller\lib\RollingFileWriteStream.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\node_modules\streamroller\lib\index.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\log4js\lib\appenders\file.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\log4js\lib\appenders\index.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\log4js\lib\log4js.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\nativescript\lib\common\logger\logger.js',
    ommon\yok.js',
    'C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\nativescript\lib\nativescript-cli-lib.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\helpers\config.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\helpers\platform.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\helpers\copyRules.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\helpers\fileReplacements.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\configuration\base.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\configuration\index.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\index.js',
    'C:\Users\Admin\Desktop\myCoolApp2\webpack.config.js',
    'C:\Users\Admin\Desktop\myCoolApp2\node_modules\@NativeScript\webpack\dist\bin\index.js'
    ]
    }
    No configuration!
    Executing webpack failed with exit code 0.

Reproduction

  1. create app using ns CLI: 'ns create myCoolApp2 --js'
  2. ns platform add android
  3. create & launch virtual device in android studio (api 31/api 26)
  4. ns run android

Relevant log output (if applicable)

Looking for project in 'C:\Users\Admin\Desktop\myCoolApp2'
Project directory is 'C:\Users\Admin\Desktop\myCoolApp2'.
Initializing project identifiers. Config:  {
  id: 'org.nativescript.myCoolApp2',
  appPath: 'app',
  appResourcesPath: 'App_Resources',
  android: { v8Flags: '--expose_gc', markingMode: 'none' }
}
Loading extensions.
Collecting system information...
System information:
{
  "platform": "win32",
  "shell": "C:\\WINDOWS\\system32\\cmd.exe",
  "os": "Windows 10 Home 6.3.19045",
  "procArch": "x64",
  "nodeVer": "16.17.0",
  "npmVer": "9.6.2",
  "nodeGypVer": null,
  "nativeScriptCliVersion": "8.4.0",
  "gitVer": "2.34.1.windows.1",
  "dotNetVer": "4.8.04084",
  "javacVersion": "11.0.13",
  "javaVersion": "11.0.13",
  "javaPath": "C:\\Program Files\\Java\\jdk-11.0.13\\bin\\java.exe",
  "adbVer": "1.0.41",
  "androidInstalled": true,
  "monoVer": null,
  "gradleVer": "7.1.1",
  "isAndroidSdkConfiguredCorrectly": true,
  "xcodeprojLocation": null,
  "itunesInstalled": false,
  "isCocoaPodsWorkingCorrectly": false,
  "isCocoaPodsUpdateRequired": false,
  "pythonInfo": null
}
Current CLI version:  8.4.0
Project dir from hooksArgs is: undefined.
Hooks directories: [ 'C:\\Users\\Admin\\Desktop\\myCoolApp2\\hooks' ]
BeforeHookName for command resolveCommand is before-resolveCommand
Project dir from hooksArgs is: undefined.
Hooks directories: [ 'C:\\Users\\Admin\\Desktop\\myCoolApp2\\hooks' ]
AfterHookName for command resolveCommand is after-resolveCommand
Starting watch on killswitch C:\Users\Admin\AppData\Local\Temp\Mero\KillSwitches\cli
Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.
The stackTrace of the location trying to handle SIGINT is:
    at process.on (C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\n[email protected]\node_modules\nativescript\lib\nativescript-cli.js:26:28)
    at C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\s[email protected]\node_modules\signal-exit\index.js:158:17   
    at Array.filter (<anonymous>)
    at load (C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\s[email protected]\node_modules\signal-exit\index.js:156:23)
    at module.exports (C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\s[email protected]\node_modules\signal-exit\index.js:62:7)
    at Object.<anonymous> (C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\p[email protected]\node_modules\proper-lockfile\lib\lockfile.js:331:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
spawn: C:\Program Files\nodejs\node.exe "C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\nativescript\lib\detached-processes\cleanup-process.js" "C:\Users\Admin\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\nativescript\lib\bootstrap.js"
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
List of registered commands: /?, apple-login, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, clean, config, config|get, config|set, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, devices, devices|android, devices|ios, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, doctor|android, doctor|ios, error-reporting, extension, extension|install, extension|uninstall, fonts, generate, help, info, install, migrate, package-manager, package-manager|set, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|build, plugin|create, plugin|install, plugin|remove, plugin|update, post-install-cli, prepare, preview, proxy, proxy|clear, proxy|set, publish, publish|ios, resources, resources|generate|icons, resources|generate|splashes, resources|update, run, run|android, run|ios, setup, test, test|android, test|init, test|ios, typings, update, usage-reporting
Reading help for command ''. FileName is 'start.md'.

Environment

OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Shell: Not Found
node: 16.17.0
npm: 9.6.2
nativescript: Not Found

# android
java: Not Found
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: Not Found
cocoapods: Not Found
python: Not Found
python3: Not Found
ruby: Not Found
platforms: Not Found

Dependencies

"dependencies": {
  "@nativescript/core": "~8.4.0",
  "@nativescript/theme": "~3.0.2",
  "svelte-native": "~1.0.0"
},
"devDependencies": {
  "@nativescript/android": "8.4.0",
  "@nativescript/types": "~8.4.0",
  "@nativescript/webpack": "~5.0.12",
  "svelte": "~3.44.0",
  "svelte-loader": "^3.1.2",
  "svelte-native-preprocessor": "^1.0.0",
  "svelte-preprocess": "^4.7.0",
  "typescript": "~4.8.4"
}

Please accept these terms

@MeroVinggen MeroVinggen added the bug-pending-triage Reported bug, pending triage to confirm. label Mar 26, 2023
@OPADA-Eng
Copy link

I run into the same issue but with a different package.
it seems there is an issue with a newer version of the CLI that doesn't install the packages correctly after ns clean command.
I used to resolve it by the following:

  1. ns clean
  2. npm i
  3. ns run android

I hope this can be helpful.

@MeroVinggen
Copy link
Author

@OPADA-Eng thx for your help, but it didn't solve the problem

@rigor789
Copy link
Member

rigor789 commented Apr 6, 2023

Looks like you're using pnpm for your global cli install. Try npm or yarn, as pnpm's strict dep layout might be preventing one of our deps from working. There's work going on for updating all of our CLIs dependencies, and that might solve the issue, but I'm not sure.

@MeroVinggen
Copy link
Author

I tried with npm all same steps and got new error:

"The webpack configuration file C:\Users\Admin\Desktop\myCoolApp\webpack.config.js does not exist. Ensure the file exists, or update the path in nativescript.config.(js|ts)"

I don't remember if webpack.config was in the previous attempt or not, but unfortunately ns is unusable for now

@ghost
Copy link

ghost commented Apr 12, 2023

I second this. Same problem with no resolution in sight.

@rigor789
Copy link
Member

The webpack config missing issue has been fixed today (#5729), awaiting release in a patch release soon.

Anything else is lacking details, and would be better discussed on Discord: https://nativescript.org/discord

@MeroVinggen
Copy link
Author

It works, now we are able to launch common template. Thx for your responding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-pending-triage Reported bug, pending triage to confirm.
Projects
None yet
Development

No branches or pull requests

3 participants