iOS NativeScript 权限错误生成 EACCES
iOS NativeScript permission Error spawn EACCES
我正在尝试设置 nativescript 开发环境。我按照官方文档中描述的步骤进行操作。 Link
之后我使用
创建了一个新项目
tns create my-first-app --template tns-template-hello-world-ng
然后我使用以下命令添加了 iOS 和 Android 平台
tns platform add ios
tns platform add android
执行时
tns run android
一切正常。模拟器正在启动并打开应用程序。
然而,当 运行
tns run ios
我收到以下错误:
Searching for Devices...
spawn EACCES
我已经尝试更改应用程序目录的权限
sudo chmod -R a+rwx /[AppFolder]
正在执行
sudo tns run ios
没有解决问题
编辑 2017-10-5
回应 Nikolai Tsonevs 的回答:
执行以下没有解决问题:
tns platform remove ios
npm cache clean --force
tns platform add ios
tns run ios
我的节点版本是:v8.4.0
我的 npm 版本是:5.4.2
我还执行了以下命令与您分享输出(假设 Nikolai 的意思是 ios 而不是 android):
tns platform remove ios
tns platform add ios --log trace > out.txt
这是输出:
Loading extensions.
execFile: /usr/local/share/android-sdk/platform-tools/adb "help"
Exec uname -a
stdout: Darwin *** 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64
stderr:
Exec npm -v
stdout: 5.4.2
stderr:
spawn: java "-version"
Exec node-gyp -v
stdout:
stderr: /bin/sh: node-gyp: command not found
Error while executing node-gyp -v: Command failed: node-gyp -v
/bin/sh: node-gyp: command not found
Exec xcodebuild -version
stdout: Xcode 9.0
Build version 9A235
stderr:
Exec gem which xcodeproj
stdout:
stderr: ERROR: Can't find ruby library file or shared library xcodeproj
Error while executing gem which xcodeproj: Command failed: gem which xcodeproj
ERROR: Can't find ruby library file or shared library xcodeproj
Exec pod --version
stdout:
stderr: /bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
Error while executing pod --version: Command failed: pod --version
/bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
Exec '/usr/local/share/android-sdk/platform-tools/adb' version
stdout: Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as /usr/local/share/android-sdk/platform-tools/adb
stderr:
spawn: /usr/local/share/android-sdk/emulator/emulator "-help"
Result when throw error is false:
{ stdout: 'Android Emulator usage: emulator [options] [-qemu args]\n options:\n -list-avds list available AVDs\n -sysdir <dir> search for system disk images in <dir>\n -system <file> read initial system image from <file>\n -vendor <file> read initial vendor image from <file>\n -writable-system make system & vendor image writable after \'adb remount\'\n -datadir <dir> write user data into <dir>\n -kernel <file> use specific emulated kernel\n -ramdisk <file> ramdisk image (default <system>/ramdisk.img\n -image <file> obsolete, use -system <file> instead\n -initdata <file> same as \'-init-data <file>\'\n -data <file> data image (default <datadir>/userdata-qemu.img\n -logcat-output <file> output file of logcat(default none)\n -partition-size <size> system/data partition size in MBs\n -cache <file> cache partition image (default is temporary file)\n -cache-size <size> cache partition size in MBs\n -no-cache disable the cache partition\n -nocache same as -no-cache\n -sdcard <file> SD card image (default <datadir>/sdcard.img\n -snapstorage <file> file that contains all state snapshots (default <datadir>/snapshots.img)\n -no-snapstorage do not mount a snapshot storage file (this disables all snapshot functionality)\n -snapshot <name> name of snapshot within storage file for auto-start and auto-save (default \'default-boot\')\n -no-snapshot perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage\n -no-snapshot-save do not auto-save to snapshot on exit: abandon changed state\n -no-snapshot-load do not auto-start from snapshot: perform a full boot\n -snapshot-list show a list of available snapshots\n -no-snapshot-update-time do not do try to correct snapshot time on restore\n -wipe-data reset the user data image (copy it from initdata)\n -avd <name> use a specific android virtual device\n -skindir <dir> search skins in <dir> (default <system>/skins)\n -skin <name> select a given skin\n -no-skin deprecated: create an AVD with no skin instead\n -noskin same as -no-skin\n -memory <size> physical RAM size in MBs\n -cores <number> Set number of CPU cores to emulator\n -accel <mode> Configure emulation acceleration\n -no-accel Same as \'-accel off\'\n -ranchu Use new emulator backend instead of the classic one\n -engine <engine> Select engine. auto|classic|qemu2\n -netspeed <speed> maximum network download/upload speeds\n -netdelay <delay> network latency emulation\n -netfast disable network shaping\n -code-profile <name> enable code profiling\n -show-kernel display kernel messages\n -shell enable root shell on current terminal\n -no-jni disable JNI checks in the Dalvik runtime\n -nojni same as -no-jni\n -logcat <tags> enable logcat output with given tags\n -no-audio disable audio support\n -noaudio same as -no-audio\n -audio <backend> use specific audio backend\n -radio <device> redirect radio modem interface to character device\n -port <port> TCP port that will be used for the console\n -ports <consoleport>,<adbport> TCP ports used for the console and adb bridge\n -onion <image> use overlay PNG image over screen\n -onion-alpha <%age> specify onion-skin translucency\n -onion-rotation 0|1|2|3 specify onion-skin rotation\n -dpi-device <dpi> specify device\'s resolution in dpi (default 165)\n -scale <scale> scale emulator window (deprecated)\n -http-proxy <proxy> make TCP connections through a HTTP/HTTPS proxy\n -timezone <timezone> use this timezone instead of the host\'s default\n -dns-server <servers> use this DNS server(s) in the emulated system\n -cpu-delay <cpudelay> throttle CPU emulation\n -no-boot-anim disable animation for faster boot\n -no-window disable graphical window display\n -version display emulator version number\n -report-console <socket> report console port to remote socket\n -gps <device> redirect NMEA GPS to character device\n -shell-serial <device> specific character device for root shell\n -tcpdump <file> capture network packets to file\n -bootchart <timeout> enable bootcharting\n -charmap <file> use specific key character map\n -studio-params <file> used by Android Studio to provide parameters\n -prop <name>=<value> set system property on boot\n -shared-net-id <number> join the shared network, using IP address 10.1.2.<number>\n -nand-limits <nlimits> enforce NAND/Flash read/write thresholds\n -gpu <mode> set hardware OpenGLES emulation mode\n -camera-back <mode> set emulation mode for a camera facing back\n -camera-front <mode> set emulation mode for a camera facing front\n -webcam-list lists web cameras available for emulation\n -screen <mode> set emulated screen mode\n -force-32bit always use 32-bit emulator\n -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode\n -unix-pipe <path> Add <path> to the list of allowed Unix pipes\n -fixed-scale Use fixed 1:1 scale for the initial emulator window.\n -wait-for-debugger Pause on launch and wait for a debugger process to attach before resuming\n -skip-adb-auth Skip adb authentication dialogue\n -metrics-to-console Enable usage metrics and print the messages to stdout\n -metrics-to-file <file> Enable usage metrics and write the messages into specified file\n\n -qemu args... pass arguments to qemu\n -qemu -h display qemu help\n\n -verbose same as \'-debug-init\'\n -debug <tags> enable/disable debug messages\n -debug-<tag> enable specific debug messages\n -debug-no-<tag> disable specific debug messages\n\n -help print this help\n -help-<option> print option-specific help\n\n -help-disk-images about disk images\n -help-debug-tags debug tags for -debug <tags>\n -help-char-devices character <device> specification\n -help-environment environment variables\n -help-virtual-device virtual device management\n -help-sdk-images about disk images when using the SDK\n -help-build-images about disk images when building Android\n -help-all prints all help content\n\n',
stderr: '',
exitCode: 0 }
The result of checking is Android Emulator installed is:
- stdout: Android Emulator usage: emulator [options] [-qemu args]
options:
-list-avds list available AVDs
-sysdir <dir> search for system disk images in <dir>
-system <file> read initial system image from <file>
-vendor <file> read initial vendor image from <file>
-writable-system make system & vendor image writable after 'adb remount'
-datadir <dir> write user data into <dir>
-kernel <file> use specific emulated kernel
-ramdisk <file> ramdisk image (default <system>/ramdisk.img
-image <file> obsolete, use -system <file> instead
-initdata <file> same as '-init-data <file>'
-data <file> data image (default <datadir>/userdata-qemu.img
-logcat-output <file> output file of logcat(default none)
-partition-size <size> system/data partition size in MBs
-cache <file> cache partition image (default is temporary file)
-cache-size <size> cache partition size in MBs
-no-cache disable the cache partition
-nocache same as -no-cache
-sdcard <file> SD card image (default <datadir>/sdcard.img
-snapstorage <file> file that contains all state snapshots (default <datadir>/snapshots.img)
-no-snapstorage do not mount a snapshot storage file (this disables all snapshot functionality)
-snapshot <name> name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
-no-snapshot perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage
-no-snapshot-save do not auto-save to snapshot on exit: abandon changed state
-no-snapshot-load do not auto-start from snapshot: perform a full boot
-snapshot-list show a list of available snapshots
-no-snapshot-update-time do not do try to correct snapshot time on restore
-wipe-data reset the user data image (copy it from initdata)
-avd <name> use a specific android virtual device
-skindir <dir> search skins in <dir> (default <system>/skins)
-skin <name> select a given skin
-no-skin deprecated: create an AVD with no skin instead
-noskin same as -no-skin
-memory <size> physical RAM size in MBs
-cores <number> Set number of CPU cores to emulator
-accel <mode> Configure emulation acceleration
-no-accel Same as '-accel off'
-ranchu Use new emulator backend instead of the classic one
-engine <engine> Select engine. auto|classic|qemu2
-netspeed <speed> maximum network download/upload speeds
-netdelay <delay> network latency emulation
-netfast disable network shaping
-code-profile <name> enable code profiling
-show-kernel display kernel messages
-shell enable root shell on current terminal
-no-jni disable JNI checks in the Dalvik runtime
-nojni same as -no-jni
-logcat <tags> enable logcat output with given tags
-no-audio disable audio support
-noaudio same as -no-audio
-audio <backend> use specific audio backend
-radio <device> redirect radio modem interface to character device
-port <port> TCP port that will be used for the console
-ports <consoleport>,<adbport> TCP ports used for the console and adb bridge
-onion <image> use overlay PNG image over screen
-onion-alpha <%age> specify onion-skin translucency
-onion-rotation 0|1|2|3 specify onion-skin rotation
-dpi-device <dpi> specify device's resolution in dpi (default 165)
-scale <scale> scale emulator window (deprecated)
-http-proxy <proxy> make TCP connections through a HTTP/HTTPS proxy
-timezone <timezone> use this timezone instead of the host's default
-dns-server <servers> use this DNS server(s) in the emulated system
-cpu-delay <cpudelay> throttle CPU emulation
-no-boot-anim disable animation for faster boot
-no-window disable graphical window display
-version display emulator version number
-report-console <socket> report console port to remote socket
-gps <device> redirect NMEA GPS to character device
-shell-serial <device> specific character device for root shell
-tcpdump <file> capture network packets to file
-bootchart <timeout> enable bootcharting
-charmap <file> use specific key character map
-studio-params <file> used by Android Studio to provide parameters
-prop <name>=<value> set system property on boot
-shared-net-id <number> join the shared network, using IP address 10.1.2.<number>
-nand-limits <nlimits> enforce NAND/Flash read/write thresholds
-gpu <mode> set hardware OpenGLES emulation mode
-camera-back <mode> set emulation mode for a camera facing back
-camera-front <mode> set emulation mode for a camera facing front
-webcam-list lists web cameras available for emulation
-screen <mode> set emulated screen mode
-force-32bit always use 32-bit emulator
-selinux <disabled|permissive> Set SELinux to either disabled or permissive mode
-unix-pipe <path> Add <path> to the list of allowed Unix pipes
-fixed-scale Use fixed 1:1 scale for the initial emulator window.
-wait-for-debugger Pause on launch and wait for a debugger process to attach before resuming
-skip-adb-auth Skip adb authentication dialogue
-metrics-to-console Enable usage metrics and print the messages to stdout
-metrics-to-file <file> Enable usage metrics and write the messages into specified file
-qemu args... pass arguments to qemu
-qemu -h display qemu help
-verbose same as '-debug-init'
-debug <tags> enable/disable debug messages
-debug-<tag> enable specific debug messages
-debug-no-<tag> disable specific debug messages
-help print this help
-help-<option> print option-specific help
-help-disk-images about disk images
-help-debug-tags debug tags for -debug <tags>
-help-char-devices character <device> specification
-help-environment environment variables
-help-virtual-device virtual device management
-help-sdk-images about disk images when using the SDK
-help-build-images about disk images when building Android
-help-all prints all help content
- stderr:
Exec mono --version
stdout:
stderr: /bin/sh: mono: command not found
Error while executing mono --version: Command failed: mono --version
/bin/sh: mono: command not found
Exec git --version
stdout: git version 2.13.5 (Apple Git-94)
stderr:
Exec gradle -v
stdout:
stderr: /bin/sh: gradle: command not found
Error while executing gradle -v: Command failed: gradle -v
/bin/sh: gradle: command not found
Exec "/Library/Java/Home/bin/javac" -version
stdout:
stderr: javac 1.8.0_144
System information:
{ procInfo: 'nativescript/3.2.1',
platform: 'darwin',
os: 'Darwin *** 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64\n',
shell: '/bin/bash',
dotNetVer: null,
procArch: 'x64',
nodeVer: 'v8.4.0',
npmVer: '5.4.2',
javaVer: '1.8.0',
nodeGypVer: null,
xcodeVer: 'Xcode 9.0\nBuild version 9A235\n',
xcodeprojGemLocation: null,
itunesInstalled: true,
cocoapodVer: null,
adbVer: 'Android Debug Bridge version 1.0.39',
emulatorInstalled: true,
monoVer: null,
gitVer: '2.13.5 (Apple Git-94)',
gradleVer: null,
javacVersion: '1.8.0_144' }
Looking for project in '/Users/***/Documents/NativeScript/my-first-app'
Project directory is '/Users/***/Documents/NativeScript/my-first-app'.
Exec which xcodebuild
stdout: /usr/bin/xcodebuild
stderr:
Exec xcodebuild -version | head -n 1 | sed -e 's/Xcode //'
stdout: 9.0
stderr:
Initializing analytics statuses.
Analytics statuses: { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
Creating NativeScript project for the ios platform
Path: /Users/***/Documents/NativeScript/my-first-app/platforms/ios
Package: org.nativescript.myfirstapp
Name: myfirstapp
Copying template files...
[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0mExec npm view tns-ios dist-tags --json
stdout: {
"latest": "3.2.0",
"next": "3.2.0-2017-9-5-2",
"rc": "3.2.0-rc-2017-9-5-2"
}
stderr:
Using version 3.2.0.
Installing tns-ios
spawn: npm "install" "tns-ios@3.2.0" "--silent" "--save-exact" "--save"
[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m+ tns-ios@3.2.0
added 1 package in 2.314s
spawn: npm "install" "tns-ios@3.2.0" "--silent" "--save-exact" "--save" "--json" "--dry-run" "--prefix" "/Users/***/Documents/NativeScript/my-first-app"
[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0mFound shared scheme at xcschemeFilePath, renaming to match project name.
Checkpoint 0
Checkpoint 1
Checkpoint 2
[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0mExec npm uninstall tns-ios --save
stdout: removed 1 package in 0.473s
stderr:
[0G[2KProject successfully created.
编辑:2017-10-06
作为尼古拉回答的结果,我做了以下事情:
npm i -g node-gyp
sudo gem install xcodeproj
brew install mono
brew install gradle (was not installed as well)
brew install cocoapods
brew link -overwrite cocoapods (brew was complaining about link issues)
之后我再次删除了 iOS 并添加了它。这也不起作用。
我执行了以下操作以获取更多信息:
tns run ios --log trace > run.txt
这里是相关的输出:
Looking for project in '/Users/***/Documents/NativeScript/my-first-app'
Project directory is '/Users/***/Documents/NativeScript/my-first-app'.
Exec which xcodebuild
stdout: /usr/bin/xcodebuild
stderr:
Exec xcodebuild -version | head -n 1 | sed -e 's/Xcode //'
stdout: 9.0
stderr:
Validate options for platform: iOS
Initializing analytics statuses.
Analytics statuses: { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
Searching for devices...
startLookingForDevices; platform is iOS
Starting to look for iOS devices.
Error while checking for devices. { Error: spawn EACCES
at _errnoException (util.js:1041:11)
at ChildProcess.spawn (internal/child_process.js:325:11)
at exports.spawn (child_process.js:493:9)
at IOSDeviceLibStdioHandler.startReadingData (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/ios-device-lib-stdio-handler.js:18:18)
at new IOSDeviceLib (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/index.js:36:34)
at IOSDeviceOperations.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:55:34)
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:13:71
at Promise (<anonymous>)
at __awaiter (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:9:12) code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }
Exec ps cax | grep launchd_sim
stdout: 4864 ?? R 0:00.17 launchd_sim
stderr:
Found device with identifier '9B7746B9-D04D-4C57-9158-4A5A28D5AA08'
startLookingForDevices; platform is iOS
你能尝试用
清理 npm 缓存吗
npm cache clean
删除平台 tns platform remove ios
再次添加 tns platform add ios
使用tns run ios
启动应用程序
如果问题依然存在,能不能把tns platform remove ios
的平台去掉再重新添加
tns platform add android --log trace > out.txt
然后您可以共享 out.txt 文件的输出,这有助于进一步调查问题。此外,请提供有关您的 node
和 npm
版本的信息。
编辑:
嗨@Anton 由于提供的日志,我发现有几个错误,这些错误是在添加平台时抛出的。第一个是找不到 node-gyp
插件。要解决此问题,您有两种选择。
第一个是使用 npm install node-gyp --g
手动安装插件。如果这不能解决问题,我建议使用 npm cache clear
清理 npm 缓存并降级到最新的 LTS 节点版本 6.11.4。
关于另外两个错误,请确保您已安装 xcodeproj
和 cocoapods
。如果在以下情况下没有安装它们:sudo gem install xcodeproj
sudo gem install cocoapods
感谢Nikolay的大力帮助,我终于解决了这个问题。
NativeScript 节点模块上的权限设置不正确,因此我执行了以下操作:
chmod -R +x /usr/local/lib/node_modules/nativescript/
我正在尝试设置 nativescript 开发环境。我按照官方文档中描述的步骤进行操作。 Link
之后我使用
创建了一个新项目tns create my-first-app --template tns-template-hello-world-ng
然后我使用以下命令添加了 iOS 和 Android 平台
tns platform add ios
tns platform add android
执行时
tns run android
一切正常。模拟器正在启动并打开应用程序。
然而,当 运行
tns run ios
我收到以下错误:
Searching for Devices...
spawn EACCES
我已经尝试更改应用程序目录的权限
sudo chmod -R a+rwx /[AppFolder]
正在执行
sudo tns run ios
没有解决问题
编辑 2017-10-5 回应 Nikolai Tsonevs 的回答:
执行以下没有解决问题:
tns platform remove ios
npm cache clean --force
tns platform add ios
tns run ios
我的节点版本是:v8.4.0 我的 npm 版本是:5.4.2
我还执行了以下命令与您分享输出(假设 Nikolai 的意思是 ios 而不是 android):
tns platform remove ios
tns platform add ios --log trace > out.txt
这是输出:
Loading extensions.
execFile: /usr/local/share/android-sdk/platform-tools/adb "help"
Exec uname -a
stdout: Darwin *** 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64
stderr:
Exec npm -v
stdout: 5.4.2
stderr:
spawn: java "-version"
Exec node-gyp -v
stdout:
stderr: /bin/sh: node-gyp: command not found
Error while executing node-gyp -v: Command failed: node-gyp -v
/bin/sh: node-gyp: command not found
Exec xcodebuild -version
stdout: Xcode 9.0
Build version 9A235
stderr:
Exec gem which xcodeproj
stdout:
stderr: ERROR: Can't find ruby library file or shared library xcodeproj
Error while executing gem which xcodeproj: Command failed: gem which xcodeproj
ERROR: Can't find ruby library file or shared library xcodeproj
Exec pod --version
stdout:
stderr: /bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
Error while executing pod --version: Command failed: pod --version
/bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
Exec '/usr/local/share/android-sdk/platform-tools/adb' version
stdout: Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as /usr/local/share/android-sdk/platform-tools/adb
stderr:
spawn: /usr/local/share/android-sdk/emulator/emulator "-help"
Result when throw error is false:
{ stdout: 'Android Emulator usage: emulator [options] [-qemu args]\n options:\n -list-avds list available AVDs\n -sysdir <dir> search for system disk images in <dir>\n -system <file> read initial system image from <file>\n -vendor <file> read initial vendor image from <file>\n -writable-system make system & vendor image writable after \'adb remount\'\n -datadir <dir> write user data into <dir>\n -kernel <file> use specific emulated kernel\n -ramdisk <file> ramdisk image (default <system>/ramdisk.img\n -image <file> obsolete, use -system <file> instead\n -initdata <file> same as \'-init-data <file>\'\n -data <file> data image (default <datadir>/userdata-qemu.img\n -logcat-output <file> output file of logcat(default none)\n -partition-size <size> system/data partition size in MBs\n -cache <file> cache partition image (default is temporary file)\n -cache-size <size> cache partition size in MBs\n -no-cache disable the cache partition\n -nocache same as -no-cache\n -sdcard <file> SD card image (default <datadir>/sdcard.img\n -snapstorage <file> file that contains all state snapshots (default <datadir>/snapshots.img)\n -no-snapstorage do not mount a snapshot storage file (this disables all snapshot functionality)\n -snapshot <name> name of snapshot within storage file for auto-start and auto-save (default \'default-boot\')\n -no-snapshot perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage\n -no-snapshot-save do not auto-save to snapshot on exit: abandon changed state\n -no-snapshot-load do not auto-start from snapshot: perform a full boot\n -snapshot-list show a list of available snapshots\n -no-snapshot-update-time do not do try to correct snapshot time on restore\n -wipe-data reset the user data image (copy it from initdata)\n -avd <name> use a specific android virtual device\n -skindir <dir> search skins in <dir> (default <system>/skins)\n -skin <name> select a given skin\n -no-skin deprecated: create an AVD with no skin instead\n -noskin same as -no-skin\n -memory <size> physical RAM size in MBs\n -cores <number> Set number of CPU cores to emulator\n -accel <mode> Configure emulation acceleration\n -no-accel Same as \'-accel off\'\n -ranchu Use new emulator backend instead of the classic one\n -engine <engine> Select engine. auto|classic|qemu2\n -netspeed <speed> maximum network download/upload speeds\n -netdelay <delay> network latency emulation\n -netfast disable network shaping\n -code-profile <name> enable code profiling\n -show-kernel display kernel messages\n -shell enable root shell on current terminal\n -no-jni disable JNI checks in the Dalvik runtime\n -nojni same as -no-jni\n -logcat <tags> enable logcat output with given tags\n -no-audio disable audio support\n -noaudio same as -no-audio\n -audio <backend> use specific audio backend\n -radio <device> redirect radio modem interface to character device\n -port <port> TCP port that will be used for the console\n -ports <consoleport>,<adbport> TCP ports used for the console and adb bridge\n -onion <image> use overlay PNG image over screen\n -onion-alpha <%age> specify onion-skin translucency\n -onion-rotation 0|1|2|3 specify onion-skin rotation\n -dpi-device <dpi> specify device\'s resolution in dpi (default 165)\n -scale <scale> scale emulator window (deprecated)\n -http-proxy <proxy> make TCP connections through a HTTP/HTTPS proxy\n -timezone <timezone> use this timezone instead of the host\'s default\n -dns-server <servers> use this DNS server(s) in the emulated system\n -cpu-delay <cpudelay> throttle CPU emulation\n -no-boot-anim disable animation for faster boot\n -no-window disable graphical window display\n -version display emulator version number\n -report-console <socket> report console port to remote socket\n -gps <device> redirect NMEA GPS to character device\n -shell-serial <device> specific character device for root shell\n -tcpdump <file> capture network packets to file\n -bootchart <timeout> enable bootcharting\n -charmap <file> use specific key character map\n -studio-params <file> used by Android Studio to provide parameters\n -prop <name>=<value> set system property on boot\n -shared-net-id <number> join the shared network, using IP address 10.1.2.<number>\n -nand-limits <nlimits> enforce NAND/Flash read/write thresholds\n -gpu <mode> set hardware OpenGLES emulation mode\n -camera-back <mode> set emulation mode for a camera facing back\n -camera-front <mode> set emulation mode for a camera facing front\n -webcam-list lists web cameras available for emulation\n -screen <mode> set emulated screen mode\n -force-32bit always use 32-bit emulator\n -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode\n -unix-pipe <path> Add <path> to the list of allowed Unix pipes\n -fixed-scale Use fixed 1:1 scale for the initial emulator window.\n -wait-for-debugger Pause on launch and wait for a debugger process to attach before resuming\n -skip-adb-auth Skip adb authentication dialogue\n -metrics-to-console Enable usage metrics and print the messages to stdout\n -metrics-to-file <file> Enable usage metrics and write the messages into specified file\n\n -qemu args... pass arguments to qemu\n -qemu -h display qemu help\n\n -verbose same as \'-debug-init\'\n -debug <tags> enable/disable debug messages\n -debug-<tag> enable specific debug messages\n -debug-no-<tag> disable specific debug messages\n\n -help print this help\n -help-<option> print option-specific help\n\n -help-disk-images about disk images\n -help-debug-tags debug tags for -debug <tags>\n -help-char-devices character <device> specification\n -help-environment environment variables\n -help-virtual-device virtual device management\n -help-sdk-images about disk images when using the SDK\n -help-build-images about disk images when building Android\n -help-all prints all help content\n\n',
stderr: '',
exitCode: 0 }
The result of checking is Android Emulator installed is:
- stdout: Android Emulator usage: emulator [options] [-qemu args]
options:
-list-avds list available AVDs
-sysdir <dir> search for system disk images in <dir>
-system <file> read initial system image from <file>
-vendor <file> read initial vendor image from <file>
-writable-system make system & vendor image writable after 'adb remount'
-datadir <dir> write user data into <dir>
-kernel <file> use specific emulated kernel
-ramdisk <file> ramdisk image (default <system>/ramdisk.img
-image <file> obsolete, use -system <file> instead
-initdata <file> same as '-init-data <file>'
-data <file> data image (default <datadir>/userdata-qemu.img
-logcat-output <file> output file of logcat(default none)
-partition-size <size> system/data partition size in MBs
-cache <file> cache partition image (default is temporary file)
-cache-size <size> cache partition size in MBs
-no-cache disable the cache partition
-nocache same as -no-cache
-sdcard <file> SD card image (default <datadir>/sdcard.img
-snapstorage <file> file that contains all state snapshots (default <datadir>/snapshots.img)
-no-snapstorage do not mount a snapshot storage file (this disables all snapshot functionality)
-snapshot <name> name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
-no-snapshot perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage
-no-snapshot-save do not auto-save to snapshot on exit: abandon changed state
-no-snapshot-load do not auto-start from snapshot: perform a full boot
-snapshot-list show a list of available snapshots
-no-snapshot-update-time do not do try to correct snapshot time on restore
-wipe-data reset the user data image (copy it from initdata)
-avd <name> use a specific android virtual device
-skindir <dir> search skins in <dir> (default <system>/skins)
-skin <name> select a given skin
-no-skin deprecated: create an AVD with no skin instead
-noskin same as -no-skin
-memory <size> physical RAM size in MBs
-cores <number> Set number of CPU cores to emulator
-accel <mode> Configure emulation acceleration
-no-accel Same as '-accel off'
-ranchu Use new emulator backend instead of the classic one
-engine <engine> Select engine. auto|classic|qemu2
-netspeed <speed> maximum network download/upload speeds
-netdelay <delay> network latency emulation
-netfast disable network shaping
-code-profile <name> enable code profiling
-show-kernel display kernel messages
-shell enable root shell on current terminal
-no-jni disable JNI checks in the Dalvik runtime
-nojni same as -no-jni
-logcat <tags> enable logcat output with given tags
-no-audio disable audio support
-noaudio same as -no-audio
-audio <backend> use specific audio backend
-radio <device> redirect radio modem interface to character device
-port <port> TCP port that will be used for the console
-ports <consoleport>,<adbport> TCP ports used for the console and adb bridge
-onion <image> use overlay PNG image over screen
-onion-alpha <%age> specify onion-skin translucency
-onion-rotation 0|1|2|3 specify onion-skin rotation
-dpi-device <dpi> specify device's resolution in dpi (default 165)
-scale <scale> scale emulator window (deprecated)
-http-proxy <proxy> make TCP connections through a HTTP/HTTPS proxy
-timezone <timezone> use this timezone instead of the host's default
-dns-server <servers> use this DNS server(s) in the emulated system
-cpu-delay <cpudelay> throttle CPU emulation
-no-boot-anim disable animation for faster boot
-no-window disable graphical window display
-version display emulator version number
-report-console <socket> report console port to remote socket
-gps <device> redirect NMEA GPS to character device
-shell-serial <device> specific character device for root shell
-tcpdump <file> capture network packets to file
-bootchart <timeout> enable bootcharting
-charmap <file> use specific key character map
-studio-params <file> used by Android Studio to provide parameters
-prop <name>=<value> set system property on boot
-shared-net-id <number> join the shared network, using IP address 10.1.2.<number>
-nand-limits <nlimits> enforce NAND/Flash read/write thresholds
-gpu <mode> set hardware OpenGLES emulation mode
-camera-back <mode> set emulation mode for a camera facing back
-camera-front <mode> set emulation mode for a camera facing front
-webcam-list lists web cameras available for emulation
-screen <mode> set emulated screen mode
-force-32bit always use 32-bit emulator
-selinux <disabled|permissive> Set SELinux to either disabled or permissive mode
-unix-pipe <path> Add <path> to the list of allowed Unix pipes
-fixed-scale Use fixed 1:1 scale for the initial emulator window.
-wait-for-debugger Pause on launch and wait for a debugger process to attach before resuming
-skip-adb-auth Skip adb authentication dialogue
-metrics-to-console Enable usage metrics and print the messages to stdout
-metrics-to-file <file> Enable usage metrics and write the messages into specified file
-qemu args... pass arguments to qemu
-qemu -h display qemu help
-verbose same as '-debug-init'
-debug <tags> enable/disable debug messages
-debug-<tag> enable specific debug messages
-debug-no-<tag> disable specific debug messages
-help print this help
-help-<option> print option-specific help
-help-disk-images about disk images
-help-debug-tags debug tags for -debug <tags>
-help-char-devices character <device> specification
-help-environment environment variables
-help-virtual-device virtual device management
-help-sdk-images about disk images when using the SDK
-help-build-images about disk images when building Android
-help-all prints all help content
- stderr:
Exec mono --version
stdout:
stderr: /bin/sh: mono: command not found
Error while executing mono --version: Command failed: mono --version
/bin/sh: mono: command not found
Exec git --version
stdout: git version 2.13.5 (Apple Git-94)
stderr:
Exec gradle -v
stdout:
stderr: /bin/sh: gradle: command not found
Error while executing gradle -v: Command failed: gradle -v
/bin/sh: gradle: command not found
Exec "/Library/Java/Home/bin/javac" -version
stdout:
stderr: javac 1.8.0_144
System information:
{ procInfo: 'nativescript/3.2.1',
platform: 'darwin',
os: 'Darwin *** 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64\n',
shell: '/bin/bash',
dotNetVer: null,
procArch: 'x64',
nodeVer: 'v8.4.0',
npmVer: '5.4.2',
javaVer: '1.8.0',
nodeGypVer: null,
xcodeVer: 'Xcode 9.0\nBuild version 9A235\n',
xcodeprojGemLocation: null,
itunesInstalled: true,
cocoapodVer: null,
adbVer: 'Android Debug Bridge version 1.0.39',
emulatorInstalled: true,
monoVer: null,
gitVer: '2.13.5 (Apple Git-94)',
gradleVer: null,
javacVersion: '1.8.0_144' }
Looking for project in '/Users/***/Documents/NativeScript/my-first-app'
Project directory is '/Users/***/Documents/NativeScript/my-first-app'.
Exec which xcodebuild
stdout: /usr/bin/xcodebuild
stderr:
Exec xcodebuild -version | head -n 1 | sed -e 's/Xcode //'
stdout: 9.0
stderr:
Initializing analytics statuses.
Analytics statuses: { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
Creating NativeScript project for the ios platform
Path: /Users/***/Documents/NativeScript/my-first-app/platforms/ios
Package: org.nativescript.myfirstapp
Name: myfirstapp
Copying template files...
[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0mExec npm view tns-ios dist-tags --json
stdout: {
"latest": "3.2.0",
"next": "3.2.0-2017-9-5-2",
"rc": "3.2.0-rc-2017-9-5-2"
}
stderr:
Using version 3.2.0.
Installing tns-ios
spawn: npm "install" "tns-ios@3.2.0" "--silent" "--save-exact" "--save"
[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m+ tns-ios@3.2.0
added 1 package in 2.314s
spawn: npm "install" "tns-ios@3.2.0" "--silent" "--save-exact" "--save" "--json" "--dry-run" "--prefix" "/Users/***/Documents/NativeScript/my-first-app"
[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0mFound shared scheme at xcschemeFilePath, renaming to match project name.
Checkpoint 0
Checkpoint 1
Checkpoint 2
[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0m[0G [96m◜ [90mInstalling tns-ios[0m[0G [96m◠ [90mInstalling tns-ios[0m[0G [96m◝ [90mInstalling tns-ios[0m[0G [96m◞ [90mInstalling tns-ios[0m[0G [96m◡ [90mInstalling tns-ios[0m[0G [96m◟ [90mInstalling tns-ios[0mExec npm uninstall tns-ios --save
stdout: removed 1 package in 0.473s
stderr:
[0G[2KProject successfully created.
编辑:2017-10-06 作为尼古拉回答的结果,我做了以下事情:
npm i -g node-gyp
sudo gem install xcodeproj
brew install mono
brew install gradle (was not installed as well)
brew install cocoapods
brew link -overwrite cocoapods (brew was complaining about link issues)
之后我再次删除了 iOS 并添加了它。这也不起作用。
我执行了以下操作以获取更多信息:
tns run ios --log trace > run.txt
这里是相关的输出:
Looking for project in '/Users/***/Documents/NativeScript/my-first-app'
Project directory is '/Users/***/Documents/NativeScript/my-first-app'.
Exec which xcodebuild
stdout: /usr/bin/xcodebuild
stderr:
Exec xcodebuild -version | head -n 1 | sed -e 's/Xcode //'
stdout: 9.0
stderr:
Validate options for platform: iOS
Initializing analytics statuses.
Analytics statuses: { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
Searching for devices...
startLookingForDevices; platform is iOS
Starting to look for iOS devices.
Error while checking for devices. { Error: spawn EACCES
at _errnoException (util.js:1041:11)
at ChildProcess.spawn (internal/child_process.js:325:11)
at exports.spawn (child_process.js:493:9)
at IOSDeviceLibStdioHandler.startReadingData (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/ios-device-lib-stdio-handler.js:18:18)
at new IOSDeviceLib (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/index.js:36:34)
at IOSDeviceOperations.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:55:34)
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:13:71
at Promise (<anonymous>)
at __awaiter (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:9:12) code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }
Exec ps cax | grep launchd_sim
stdout: 4864 ?? R 0:00.17 launchd_sim
stderr:
Found device with identifier '9B7746B9-D04D-4C57-9158-4A5A28D5AA08'
startLookingForDevices; platform is iOS
你能尝试用
清理 npm 缓存吗npm cache clean
删除平台
tns platform remove ios
再次添加
tns platform add ios
使用
tns run ios
启动应用程序
如果问题依然存在,能不能把tns platform remove ios
的平台去掉再重新添加
tns platform add android --log trace > out.txt
然后您可以共享 out.txt 文件的输出,这有助于进一步调查问题。此外,请提供有关您的 node
和 npm
版本的信息。
编辑:
嗨@Anton 由于提供的日志,我发现有几个错误,这些错误是在添加平台时抛出的。第一个是找不到 node-gyp
插件。要解决此问题,您有两种选择。
第一个是使用 npm install node-gyp --g
手动安装插件。如果这不能解决问题,我建议使用 npm cache clear
清理 npm 缓存并降级到最新的 LTS 节点版本 6.11.4。
关于另外两个错误,请确保您已安装 xcodeproj
和 cocoapods
。如果在以下情况下没有安装它们:sudo gem install xcodeproj
sudo gem install cocoapods
感谢Nikolay的大力帮助,我终于解决了这个问题。
NativeScript 节点模块上的权限设置不正确,因此我执行了以下操作:
chmod -R +x /usr/local/lib/node_modules/nativescript/