0

I am trying to learn NativeScript. I have done following steps to install NativeScript on my windows 8.1 Pro 64 bit machine:

  1. Installed node.js (node-v8.11.2-x64) on D drive
  2. Installed Visual Studio Code (VSCodeSetup-x64-1.23.1) on D drive
  3. Installed Git (Git-2.17.0-64-bit) on D drive
  4. Installed Android Studio (android-studio-ide-173.4720617-windows) on D drive
  5. 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:

  1. How to fix installation error for NativeScript?
  2. If I need to uninstall NativeScript, how can I do that?
  3. Which directory NativeScript gets installed with the installed command and can I install it on d drive?
learner
  • 581
  • 7
  • 27

2 Answers2

1

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
  • 4,855
  • 8
  • 35
  • 63
  • I doubt it is a memory issue, I have 32GB of RAM. Anywayz I tried your suggestion but still no luck – learner May 22 '18 at 21:05
0

@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

Aosi
  • 111
  • 2
  • 7