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
[email protected] 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
> [email protected] 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: [email protected] (node_modules\nativescript\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ [email protected]
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 [email protected] 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?
@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