NativeScript CLI installation Error - nativescript

I am trying to learn NativeScript. I have done following steps to install NativeScript on my windows 8.1 Pro 64 bit machine:
Installed node.js (node-v8.11.2-x64) on D drive
Installed Visual Studio Code (VSCodeSetup-x64-1.23.1) on D drive
Installed Git (Git-2.17.0-64-bit) on D drive
Installed Android Studio (android-studio-ide-173.4720617-windows) on D drive
Installed NativeScript by using following command: npm install -g nativescript.
I receive following error on step 5:
C:\Users\UserName>npm install -g nativescript
nativescript#4.0.1 preuninstall C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript
node preuninstall.js
Failed to complete all pre-uninstall steps.
C:\Users\UserName\AppData\Roaming\npm\tns -> C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\bin\tns
C:\Users\UserName\AppData\Roaming\npm\nativescript -> C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\bin\tns
> nativescript#4.0.1 postinstall C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript
> node postinstall.js
RangeError: Maximum call stack size exceeded
at normalizeStringWin32 (path.js:33:30)
at Object.resolve (path.js:328:20)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:68:14)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:77:24)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.3 (node_modules\nativescript\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ nativescript#4.0.1
updated 1 package in 18.244s
When I run tns doctor command I receive following information:
> C:\Users\UserName>tns doctor
>
> RangeError: Maximum call stack size exceeded
>
> at normalizeStringWin32 (path.js:33:30)
>
> at Object.resolve (path.js:328:20)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:68:14)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:77:24)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
>
> at sync (C:\Users\UserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:78:17)
I also tried to uninstall NativeScript but it gets stuck on still resolveWithNewModule, see below:
C:\Users\UserName>npm uninstall -g nativescript
[ ................] / loadDep:readdirp: sill resolveWithNewModule xcode#0.8.0 checking installable status
My questions are:
How to fix installation error for NativeScript?
If I need to uninstall NativeScript, how can I do that?
Which directory NativeScript gets installed with the installed command and can I install it on d drive?

It looks like the installation process is running out of memory.
Try running this command before running the installation:
node --max-old-space-size=8192
Set the last number according to RAM installed on your machine (2048, 4096 ecc)

#Aaron Ullal is right, the reason is mostly NodeJS heap (memory usage in V8) is running out of usable memory, is not because you have no ram left, this is a hard stop included in node exec config.
you can add a flag to increase the heap size on the go
NODE_OPTIONS="--max-old-space-size=4096" node
You can find more information here.
Please use the search tool to find similar errors or answered questions

Related

Why is Yarn not working on Ventura and how do I get it to work?

Since I installed Ventura I've been having an impossible time with Yarn. This command works on a normal linux environment but will not work on either of my Ventura machines. I've tested this on all environments using the same version of yarn (i.e. 1.22.19) and of nodejs (i.e. 12.22.12).
% yarn add -D #quasar/quasar-app-extension-testing-unit-jest
yarn add v1.22.19
[1/5]  Validating package.json...
[2/5]  Resolving packages...
warning #quasar/quasar-app-extension-testing-unit-jest > babel-jest > #jest/transform > jest-haste-map > sane#4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning #quasar/quasar-app-extension-testing-unit-jest > vue-jest > babel-plugin-transform-es2015-modules-commonjs > babel-runtime > core-js#2.6.12: core-js#<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning #quasar/quasar-app-extension-testing-unit-jest > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > w3c-hr-time#1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
[3/5]  Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz: incorrect data check".
info If you think this is a bug, please open a bug report with the information provided in "/Users/noeldacosta/repo/gitlab/netbuilder/cpd/cpd-portal/client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Can't properly install hardhat using Powershell! Persistent Error HH12: Trying to use a non-local installation of Hardhat, which is not supported

Below is a short list of my setup until I stumble upon the HH12 Hardhat Error that I keep getting:
mkdir wave (Name of my directory)
cd wave
npm init -y
npm install —save-dev hardhat
npx hardhat
Choose sample project
6a. Hardhat project root (Select)
6b. Add .gitignore
Say yes to everything
install the remaining dependencies: npm install --save-dev #nomiclabs/hardhat-waffle ethereum-waffle chai #nomiclabs/hardhat-ethers ethers
npx hardhat accounts (to see all the different accounts)...
...And then it fails here! An HH12 Hardhat Error Message: "Hardhat is not installed or installed globally. You tried to run Hardhat from a global installation or not installing it at all. This is not supported. Please install Hardhat locally using npm or Yarn, and try again." (https://hardhat.org/errors/) [BTW, these 2 lines are the ONLY docs on this error on Hardhat!].
Any suggestions?
I have tried the following possible 'fixes' to sidestep this error but to no avail:
Updating most current version of node
Restarting my PC (About 17 X now as of this writing)
Using GitBash (Instead of Powershell)
Asking mods in Hardhat Discord (None) and other Discords
Opening the Hardhat docs (And the Tutorials!!) for answers... None!
StackExchange - There's literally only 1 other person who ALSO had this problem here! But the answers here are not the solution. (Have DMd that person but no reply as of yet).
So can anyone out there help?
I believe I finally figured out the solution (at least what worked for me):
I dropped back 2 directory levels from where I was for my root project and started again there.
I updated my Node version to 16.

Unable to locate adb on macOS Catalina

I am starting to learn how to do mobile programming with ReactNative on an android environment. I’m using MacOS Catalina and I’ve installed android studio and react-native-cli. I ran react-native init ShoppingList which passed
Downloading template,
Copying template,
Processing template
but failed at Installing CocoaPods dependencies because I wasn't at the latest OS yet(I hope this is not part of the problem because I don’t have enough memory to upgrade OS)
I’ve referred to a suggestion inside this issue, which asks me to run
npm uninstall -g react-native react-native-cli
npm install -g react-native react-native-cli
react-native start --reset-cache
I’ve also deleted the node_modules and npm install at the root of the project. Then at the root of the project I ran react-native run-android.
Which gave me the following error
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:installDebug'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/prashin/Test/ShoppingList/android/local.properties'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Inside Android Studio, the following are installed
Android 11.0(R),
Android SDK Build-Tools,
Android Emulator 30.2.6,
Android SDK-Platform-Tools 30.0.5,
Intel x86 Emulator Accelerator (HAXM installer) 7.5.1
I created a Pixel 2 Device with Release name R(API Level 30), and pressed the Play button countless times, it gives me the error of AVD Manager: Unable to locate ADB.
This is my .bash_profile file.
source ~/.profile
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
##
# Your previous /Users/prashin/.bash_profile file was backed up as /Users/prashin/.bash_profile.macports-saved_2019-10-23_at_18:32:04
##
# MacPorts Installer addition on 2019-10-23_at_18:32:04: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
export ANDROID_HOME=/Users/prashin/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
# export PATH="$PATH:/Users/$USER/Library/Android/sdk/platform-tools"
# export PATH=${PATH}:/usr/local/mysql-5.7.31-macos10.14-x86_64/bin
# Finished adapting your PATH environment variable for use with MacPorts.
And I do see an adb executable inside platform-tools according to this post.
What could I be missing here which is preventing me from running my basic application on the simulator? Do inform me if more information is needed.
Edit
A suggested solution of switching to .zprofile changed the error message instead. It got stuck at info launching emulator for 30s before producing the error below.
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug FAILED
Skipping device 'emulator-5554' (emulator-5554): Device is OFFLINE.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 2 executed, 25 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
With Catalina, Apple has changed the default shell to zsh. Therefore you have to rename your configuration files. .bashrc is now .zshrc and .bash_profile is now .zprofile. Move the contents of your .bash_profile to a new .zprofile file and restart your terminal. Run the app again with new environment variables in place.
Simply restarting the terminal made the trick for me...

`npm install` issues/failure with expo-cli and react-native-app

I really need some help with what seems to be the most basic task (setting up the expo/react-native project). I've installed the expo-cli (v3.11.7), react-native (v2.0.1), watchman (v4.9.0) and node (v12.14.1). I've followed the tutorial up until the point where I need to run expo start and I get the following error:
Your project is in SDK version >= 33.0.0, but the expo package version seems to be older.
Error: node_modules directory is missing. Please run npm install in your project directory.
Couldn't start project. Please fix the errors and restart the project.
Set EXPO_DEBUG=true in your env to view the stack trace.
I've then run npm install and tried again but the same error pops up. I've removed the node_modules folder and that didn't work either.
Update:
When I npm install this is the error I'm seeing:
npm WARN deprecated core-js#1.2.7: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://codeload.github.com/expo/react-native/tar.gz/sdk-36.0.0 failed, reason: write EPROTO 4521895360:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 40
I've installed yarn (v1.21.1) and tried installing using this with the same error:
warning expo > fbemitter > fbjs > core-js#1.2.7: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
error An unexpected error occurred: "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz: write EPROTO 4356277696:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 40
Can anyone advise?
I've managed to solve the problem. I was trying to install over my home network, which apparently has some proxy restrictions! No idea why.
Someone advised me to try again but connected to another network or my mobile hotspot. I tried this and it worked! Problem solved. So I guess for any others that may be experiencing the same problem, try connecting to another network and see if that helps.
If this fails, then I suppose looking at the proxy configuration and making changes there may help. But I wouldn't advise doing this unless you know exactly what you're doing.

Getting ENAMETOOLONG

Getting the following message when trying to build for android
Processing node_modules failed. Error: spawn ENAMETOOLONG
nativescript 2.4 and android 2.4.1 - all updated.
npm version 3.10.8
node 6.9.1
also using SCSS
I googled and looks like it has to do with windows command line limit.

Resources