永久NativeScript Mac安装问题

时间:2017-12-06 02:51:24

标签: node.js bash npm nativescript nativescript-cli

我可以真正使用某人的帮助,因为我已经在很长一段时间内对此进行了故障排除,现在没有任何补救措施。

问题只是将NativeScript CLI安装到我的OSX Yosemite Mac上。我按照NS'网站的步骤(安装正确的Node.JS版本,下载Xcode 7.2(由于操作系统限制),安装了JSDK,安装了NS Sidekick,安装了适当的SDK以及其他所有必需的依赖的Android Studio。

然而,当我运行“sudo npm i -g nativescript --unsafe-perm”(否则会抛出EACCES错误)时,我得到以下日志,说我遗漏了所有这些依赖项,我知道我有但是它声称我没有。

最大的好处是虽然它仍然会说NativeScript成功安装,但每当我运行任何tns命令(如tns doctor)时,都找不到bash命令。

我确保按照向我的路径添加NS的说明以及我的Android和Java SDK。这是完整的日志:

jsmbp:~ Js$ sudo npm i -g nativescript --unsafe-perm
Password:
/Users/Jmsquillaro/.npm-packages/bin/nativescript -> /Users/Jmsquillaro/.npm-packages/lib/node_modules/nativescript/bin/tns
/Users/Jmsquillaro/.npm-packages/bin/tns -> /Users/Jmsquillaro/.npm-packages/lib/node_modules/nativescript/bin/tns

> fsevents@1.1.2 install /Users/Jmsquillaro/.npm-packages/lib/node_modules/nativescript/node_modules/fsevents
> node install

[fsevents] Success: "/Users/Jmsquillaro/.npm-packages/lib/node_modules/nativescript/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> nativescript@3.3.1 postinstall /Users/Jmsquillaro/.npm-packages/lib/node_modules/nativescript
> node postinstall.js

WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements

TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.

WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the native emulator.
To be able to build for Android and run apps in the native emulator, verify that you have
installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements

TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.

WARNING: CocoaPods is not installed or is not configured properly.
You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods.
The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the ANDROID_HOME variable to point to the root of your Android SDK installation directory.

Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ sdkmanager to manage your Android SDK versions.

You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=26'.
Run $ sdkmanager from your command-line to install required Android Build Tools. In case you already have them installed, make sure ANDROID_HOME environment variable is set correctly.

You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ sdkmanager to manage the Android Support Repository. In case you already have it installed, make sure ANDROID_HOME environment variable is set correctly.

Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable.
You will not be able to build your projects for Android.
To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as
 described in http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-os-x.html#system-requirements

There seem to be issues with your configuration.
? Do you want to visit the official documentation? No
? Do you want to run the setup script? No
Your components are up-to-date: 
nativescript,tns-core-modules,tns-android,tns-ios

Autocompletion is already enabled

Installation successful. You are good to go. Connect with us on http://twitter.com/NativeScript.

+ nativescript@3.3.1
added 692 packages in 156.18s
jsmbp:~ Js$ tns doctor
-bash: tns: command not found

我该怎么做才能解决这个问题?每次我卸载后尝试重新安装时,npm也会声明“rollbackFailedOptional”。 npm是否缓存了破坏的版本,我可以强制它进行真正的“重新安装吗?”一切都看起来搞砸了我真的很沮丧,我真的不想放弃NS。让我知道你的想法,谢谢你!

1 个答案:

答案 0 :(得分:1)

首先正确安装node.js。我已经对你--unsafe-perm这意味着,node.js安装没有正确完成。 我建议您使用自制软件安装nvm,然后从中安装节点。请参阅此帖https://discourse.nativescript.org/t/not-installing-on-macos/3292/4

中的解决方案