lklk03
December 10, 2021, 2:34am
1
Hi there! I have been using the command ‘yarn add netlify-cli -g’ in my react projects and deploying them to netlify without any problem. But i don’t know what happened and since today i have been facing some troubles when i want to do this. I use that command as usual but i get this error:
My nodejs version is 16.13.1. I dont know what to do or how to solve this and it’s very frustrating because i’m not being able to deploy my projects any help?
coelmay
December 10, 2021, 3:00am
2
Hi @lklk03
I see warnings , but I don’t see any errors in the screenshot provided.
In the command yarn add netlify-cli -g
the -g
flag denotes a global install. This means you do not need to add netlify-cli
to each individual project. If it is installed globally, the netlify
command is available everywhere.
I don’t use yarn
myself, but yarn add
doesn’t even seem to have a -g
flag when looking at the options here:
I believe it’s supposed to be yarn global add
:
However it also doesn’t seem to be the problem that’s being experienced.
What’s happening on my system is that it repeatedly hangs on the line:
warning "netlify-cli > @netlify/build > ts-node@10.4.0" has unmet peer dependency "typescript@>=2.7".
Eventually causing a JavaScript heap out of memory
error.
I’ve yet to pinpoint what’s occuring, but I’ve tried multiple versions of node
, multiple versions of yarn
and multiple versions of the netlify-cli
, with all failing.
Have you tried installing the netlify-cli
globally just using npm
instead of yarn
:
npm i -g netlify-cli
I’ve just noticed that yarn global
is actually yarn classic
… shows how out of touch I am with it.
Or not… since we’re talking about v1.22.17
which is apparently Classic
, so it’s really my first link that’s wrong as thats for v2
.
There doesn’t seem to be a -g
flag for add
in the Classic
version either and they explicitly draw attention to yarn global
:
coelmay
December 10, 2021, 3:32am
5
Indeed, an oversight on my part; global
is the yarn (classic) way.
Using yarn add netlify-cli
(yarn add v1.22.17 ) to add to a project failed for me also (node.js v16.13.1).
Using npm add netlify-cli
did work though.
All my tests have shown the same thing.
I can’t get yarn
to install the netlify-cli
regardless of the node
/ yarn
/ netlify-cli
versions I’ve tried.
It installs fine with npm
via npm i -g netlify-cli
.
lklk03
December 10, 2021, 3:58am
7
@nathanmartin @coelmay hey, thanks for your answers. I’ll try what you suggested about using npm and then I’ll comment again. Hope I can get success this time
coelmay
December 10, 2021, 4:11am
8
Have opened an issue on the netlify-cli
repository
opened 04:10AM - 10 Dec 21 UTC
closed 05:36PM - 10 Dec 21 UTC
type: bug
**Describe the bug**
**FATAL ERROR: Ineffective mark-compacts near heap limit… Allocation failed - JavaScript heap out of memory** occurs when adding `netlify-cli` with yarn.
Originally identified on the forums [https://answers.netlify.com/t/error-adding-netlify-cli-with-yarn/48579](https://answers.netlify.com/t/error-adding-netlify-cli-with-yarn/48579)
**To Reproduce**
Steps to reproduce the behavior:
1. Run `yarn add netlify-cli`
**Configuration**
```bash
% npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli
System:
OS: macOS 12.0.1
CPU: (12) x64 Intel(R) Core(TM) i5-10600 CPU @ 3.30GHz
Memory: 1.76 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.1 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.1.2 - /usr/local/bin/npm
npmPackages:
netlify-cli: ^8.0.19 => 8.0.19
npmGlobalPackages:
netlify-cli: 8.0.19
```
**Expected behavior**
Install to not error
**CLI Output**
```
% yarn add netlify-cli
yarn add v1.22.17
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning netlify-cli > @netlify/plugin-edge-handlers > rollup-plugin-node-polyfills > rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
warning netlify-cli > @netlify/zip-it-and-ship-it > @vercel/nft > node-pre-gyp@0.13.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
warning netlify-cli > @netlify/zip-it-and-ship-it > precinct > detective-postcss > postcss-values-parser > flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
warning netlify-cli > copy-template-dir > readdirp > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning netlify-cli > copy-template-dir > readdirp > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "netlify-cli > @netlify/build > ts-node@10.4.0" has unmet peer dependency "@types/node@*".
warning "netlify-cli > @netlify/build > ts-node@10.4.0" has unmet peer dependency "typescript@>=2.7".
<--- Last few GCs --->
[2325:0x7fe856200000] 99973 ms: Scavenge 4013.0 (4122.8) -> 4006.9 (4123.8) MB, 21.9 / 0.0 ms (average mu = 0.126, current mu = 0.054) allocation failure
[2325:0x7fe856200000] 100005 ms: Scavenge 4016.2 (4123.8) -> 4010.8 (4128.8) MB, 8.5 / 0.0 ms (average mu = 0.126, current mu = 0.054) allocation failure
[2325:0x7fe856200000] 100694 ms: Mark-sweep 4021.5 (4128.8) -> 4011.8 (4135.6) MB, 666.7 / 0.0 ms (average mu = 0.185, current mu = 0.231) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x10e767225 node::Abort() [/usr/local/bin/node]
2: 0x10e7673a8 node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x10e8de9c7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x10e8de963 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x10ea7cfe5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
6: 0x10ea8100b v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
7: 0x10ea7d8ec v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0x10ea7ad9a v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x10ea880f0 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10ea88171 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x10ea550c7 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
12: 0x10ee010ae v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
13: 0x10f1a30b9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
14: 0x10f1b9056 Builtins_ArrayPrototypeJoin [/usr/local/bin/node]
zsh: abort yarn add netlify-cli
```
**Additional context**
Works with `npm add netlify-cli`
1 Like
luke
December 10, 2021, 8:05am
9
I’ve added comments to the issue filed here:
https://github.com/netlify/cli/issues/3788
The issue is not in the Netlify CLI. The issue is in yarn
or one of its dependencies.
The only workaround that I have been able to find it to switch to npm
instead of yarn
. There are more details on the issue @coelmay created.
2 Likes
erez
December 10, 2021, 12:52pm
10
Hi all
We have identified the issue causing this and provided several workarounds in the issue , both for global installations and for local ones.
We’re still working on fixing the underlying issue and we’ll publish a fixed version of the CLI next week.
1 Like
lklk03
December 10, 2021, 3:05pm
11
So finally i found the solution in this thread yarn add netlify-cli fails with "JavaScript heap out of memory" · Issue #3788 · netlify/cli · GitHub , adding the following code to my package.json
“resolutions”: {
“@oclif /plugin-help”: “3.2.14”
},
Thanks for all who helped me with this trouble, you’re really such a great community!
1 Like
hillary
December 10, 2021, 4:53pm
12
Thanks so much for coming back and sharing this solution, @lklk03 ! This will definitely help future members who are encountering something similar.
erez
December 10, 2021, 5:35pm
13
2 Likes