0

我真的可以在这方面使用某人的帮助,因为我已经解决这个问题很长时间了,而且没有任何补救措施。

问题只是将 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,这太令人沮丧了。让我知道你的想法,谢谢!

4

1 回答 1

1

首先正确安装 node.js。我有你不得不对你--unsafe-perm这意味着,node.js 安装不正确。我建议您nvm使用自制软件安装,然后从中安装节点。请参考我在这篇文章中的解决方案https://discourse.nativescript.org/t/not-installing-on-macos/3292/4

于 2017-12-06T05:14:42.673 回答