os: linux mint 20
cmd: ns --version
7.1.1
cmd: ns devices
Connected devices & emulators
Searching for devices...
Error: spawn /usr/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/linux/x64/ios-device-lib ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:470:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
But if I use ns run android, it is working well
Same problem can't figure out why
Same issue. Ubuntu 20.04, ns-cli version 7.1.2
tns device log
Searching for devices...
Error: spawn /home/chris/.nvm/versions/node/v12.20.0/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/linux/x64/ios-device-lib ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:470:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Same issue - xubuntu 20.04. Do you guys also experience that live reload doesn't work on the android emulator?
Same issue on macOS Big Sur on a M1 mac
EDIT : version of Node was the problem, I rolled back to 15.5.0 using nvm (dunno why I picked this version in particular) and it worked !
I was using v14.15.5 (lts) and tried switching to 15.5.0 (what's up with all the deprecated packages when installing nativescript?) and still get the same response:
$ ns device
Connected devices & emulators
Searching for devices...
Error: spawn /home/rocha/.nvm/versions/node/v15.5.0/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/linux/x64/ios-device-lib ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:276:19)
at onErrorNT (node:internal/child_process:476:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
what's up with all the deprecated packages when installing nativescript?
When you npm i -g nativescript, npm often prints out a bunch of deprecated dependencies, these are generally hard to avoid since they are often transitive dependencies deeply nested in the dependency tree.
Some dependencies that are no longer maintained, we are replacing with newer alternatives, but this is not a simple process, as parts of the CLI require rewrites to support alternative dependencies. And keep in mind the CLI has been around since 2015.
(In any case, these are not really a security concern, since they are not exposed to the public (ie. not running on a public facing server), and are only used on the local machine during development, where most of the security concerns don't apply.)
As for the issue, I don't think ios-device-lib ever worked on linux - it's only compiled for win32 & darwin/x64 - in fact it shouldn't even be called, so that makes me curious why it's being called here. Can you open your global node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js (path could vary so just find where the cli's files are installed & find devices-service.js and look for getEmulatorImages( and add some console.logs - specifically interested about
console.log(this.$hostInfo.isDarwin)
That would help us narrow it down - if it prints true - then the host detection is off & needs to be adjusted.
regarding node15 & npm7: see https://github.com/NativeScript/nativescript-cli/issues/5492
For those who just want to print available devices, you can use ns devices android - that should work (unable to test, as I don't currently have access to a linux machine)
Thank you for your comment!
$ nvm current
v15.5.0
$ cat .nvm/versions/node/v15.5.0/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js | grep getEmulatorImages -A 4 -m 1
getEmulatorImages(options) {
console.log('hits me');
console.log(this.$hostInfo.isDarwin);
return __awaiter(this, void 0, void 0, function* () {
const result = Object.create(null);
$ ns device
Connected devices & emulators
Searching for devices...
Error: spawn /home/rocha/.nvm/versions/node/v15.5.0/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/linux/x64/ios-device-lib ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:276:19)
at onErrorNT (node:internal/child_process:476:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
Hmm, not quite what I expected - but looks like
Connected devices & emulators
Searching for devices...
is logged by devices-service.js -> initializeCore( which has a couple branches it could run.
Another possible clue would be to run ns devices --log trace, it may print a bit more info/traces.
hello here is my solution on linux mint 20:
npm i ios-device-lib
after this try again
ns device run
and it should run smoothly.
ps: i also connected and run a simple project from android-studio to make sure my device is connected.
also here is my versions:
`Angular CLI: 11.2.1
npm 6.14.11
node: 15.9.0
OS: Linux x64
Angular: 11.0.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
@angular-devkit/architect 0.1100.7
@angular-devkit/core 10.0.8
@angular-devkit/schematics 11.0.7
@ngtools/webpack 11.0.7
@schematics/angular 11.2.1 (cli-only)
@schematics/update 0.1102.1 (cli-only)
rxjs 6.6.3
typescript 4.0.7`
i hope this helps
Same for MacOS Big Sur
See the logs below
Trying to get macOS version.
Exec system_profiler SPSoftwareDataType -detailLevel mini
stdout: Software:
System Software Overview:
System Version: macOS 11.2.2 (20D80)
Kernel Version: Darwin 20.3.0
Time since boot: 1:51
stderr:
macOS version based on system_profiler is 11.2.
Looking for project in '/Users/myuser/myapp'
Project directory is '/Users/myuser/myapp'.
Initializing project identifiers. Config: {
id: 'com.myapp',
appPath: 'src',
appResourcesPath: 'App_Resources',
android: { v8Flags: '--expose_gc', markingMode: 'none' }
}
Loading extensions.
System information:
{
"platform": "darwin",
"shell": "/bin/zsh",
"os": "Darwin MacBook-Air-de-JHT.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64\n",
"procArch": "arm64",
"nodeVer": "14.16.0",
"npmVer": "6.14.11",
"nodeGypVer": null,
"nativeScriptCliVersion": "7.2.1",
"gitVer": "2.24.3 (Apple Git-128)",
"dotNetVer": null,
"javacVersion": "1.8.0_282",
"javaVersion": "1.8.0_282",
"javaPath": "java",
"adbVer": null,
"androidInstalled": false,
"monoVer": null,
"gradleVer": null,
"isAndroidSdkConfiguredCorrectly": false,
"xcodeVer": "12.4.0",
"xcodeprojLocation": "/usr/local/bin/xcodeproj",
"itunesInstalled": false,
"cocoaPodsVer": "1.10.1",
"isCocoaPodsWorkingCorrectly": true,
"isCocoaPodsUpdateRequired": false,
"pythonInfo": {
"isInstalled": true,
"isSixPackageInstalled": true
}
}
Current CLI version: 7.2.1
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/Users/myuser/myapp/hooks' ]
BeforeHookName for command resolveCommand is before-resolveCommand
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/Users/myuser/myapp/hooks' ]
AfterHookName for command resolveCommand is after-resolveCommand
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 (/opt/homebrew/lib/node_modules/nativescript/lib/nativescript-cli.js:26:28)
at /opt/homebrew/lib/node_modules/nativescript/node_modules/signal-exit/index.js:128:15
at Array.filter (
at load (/opt/homebrew/lib/node_modules/nativescript/node_modules/signal-exit/index.js:126:21)
at module.exports (/opt/homebrew/lib/node_modules/nativescript/node_modules/signal-exit/index.js:36:5)
at Object.
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
spawn: /Users/myuser/.nvm/versions/node/v14.16.0/bin/node "/opt/homebrew/lib/node_modules/nativescript/lib/detached-processes/cleanup-process.js" "/opt/homebrew/lib/node_modules/nativescript/lib/bootstrap.js"
Shasum of file /Users/myusser/myappapp/package.json is d36a4c76b08d719f24d9de8c6f46c4924e2f018a
Got cached result for shouldMigrate for platform: iOS
Project dir from hooksArgs is: /Users/myuser/myappapp.
Hooks directories: [ '/Users/myuser/myapp/hooks' ]
BeforeHookName for command checkEnvironment is before-checkEnvironment
Initializing analytics statuses.
Analytics statuses: { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
getInfos cacheConfig options: { forceCheck: undefined } current info from cache: [
{
message: 'Xcode is installed and is configured properly.',
platforms: [ 'iOS' ],
type: 'info'
},
{
message: 'xcodeproj is installed and is configured properly.',
platforms: [ 'iOS' ],
type: 'info'
},
{
message: 'CocoaPods are installed.',
platforms: [ 'iOS' ],
type: 'info'
},
{
message: 'CocoaPods update is not required.',
platforms: [ 'iOS' ],
type: 'info'
},
{
message: 'CocoaPods are configured properly.',
platforms: [ 'iOS' ],
type: 'info'
},
{
message: 'Your current CocoaPods version is newer than 1.0.0.',
platforms: [ 'iOS' ],
type: 'info'
},
{
message: 'Python installed and configured correctly.',
platforms: [ 'iOS' ],
type: 'info'
},
{
message: "The Python 'six' package is found.",
platforms: [ 'iOS' ],
type: 'info'
},
{
message: 'Xcode version 12.4.0 satisfies minimum required version 10.',
platforms: [ 'iOS' ],
type: 'info'
}
]
Xcode is installed and is configured properly.
xcodeproj is installed and is configured properly.
CocoaPods are installed.
CocoaPods update is not required.
CocoaPods are configured properly.
Your current CocoaPods version is newer than 1.0.0.
Python installed and configured correctly.
The Python 'six' package is found.
Xcode version 12.4.0 satisfies minimum required version 10.
Project dir from hooksArgs is: /Users/myuser/myapp.
Hooks directories: [ '/Users/myuser/myapp/hooks' ]
AfterHookName for command checkEnvironment is after-checkEnvironment
Validate options for platform: iOS
Searching for devices...
startLookingForDevices; platform is iOS
Options for ios-device-discovery {
platform: 'iOS',
shouldReturnImmediateResult: false,
emulator: false,
fullDiscovery: undefined
}
Starting to look for iOS devices.
Error: spawn /opt/homebrew/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/darwin/arm64/ios-device-lib ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
I tried to switch to other node release but same result
@j99ht for M1 a workaround until next release is
cp -R /opt/homebrew/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/darwin/x64 /opt/homebrew/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/darwin/arm64
This is just a workaround - by using rosetta 2 on the x64 binary - next release is compiled for arm64 directly and will not need the workaround.
in my case (Linux/Ubuntu 18.04 ) the workaround was to copy the "darwin" folder to a "linux folder"
cp -r /usr/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/darwin/ /usr/lib/node_modules/nativescript/node_modules/ios-device-lib/bin/linux
I'm seeing the same thing in windows, the issue in this case is that the path is incorrect (missing slash)
Most helpful comment
@j99ht for M1 a workaround until next release is
This is just a workaround - by using rosetta 2 on the x64 binary - next release is compiled for arm64 directly and will not need the workaround.