我正在尝试学习NativeScript。我已经完成了以下步骤,在Windows 8.1 Pro 64位计算机上安装NativeScript:
我在第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
当我运行tns doctor命令时,我收到以下信息:
> 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)
我还试图卸载NativeScript但它仍然卡在了resolveWithNewModule上,见下文:
C:\Users\UserName>npm uninstall -g nativescript
[ ................] / loadDep:readdirp: sill resolveWithNewModule xcode@0.8.0 checking installable status
我的问题是:
答案 0 :(得分:0)
看起来安装过程内存不足。 在运行安装之前尝试运行此命令:
node --max-old-space-size=8192
根据机器上安装的RAM(2048,4096 ecc)设置最后一个数字
答案 1 :(得分:0)
@Aaron Ullal是正确的,原因主要是NodeJS堆(V8中的内存使用)用完了可用内存,不是因为您没有可用的RAM,这是节点exec config中包含的一个硬停。
您可以添加标志来增加堆的大小
NODE_OPTIONS="--max-old-space-size=4096" node
您可以找到更多信息here。 请使用搜索工具查找类似的错误或已回答的问题