Error: Couldn't allocate enough memory

Nic's Avatar

Nic

22 Mar, 2024 07:58 PM

The yarn install always failed if the .yarn cache doesn't exist. The error is: Error: Couldn't allocate enough memory.

We tried to increase the memory with set NODE_OPTIONS=--max-old-space-size=2056, but it's doesn't work.

Image: Visual Studio 2022

Build started
Update-NodeJsInstallation 18.14.2
npm i -g corepack@0.18.0
corepack prepare yarn@3.3.0 --activate
Updating Node.js v18.14.2 (x86)
Uninstalling Node.js v21.2.0 (x86)...
Installing Node.js v18.14.2 (x86)...
added 1 package in 775ms
Preparing yarn@3.3.0 for immediate activation...
Fetching repository commit (ad1aa2f)...OK
Total: 72.2 MB in 8873 files
Running Install scripts
yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ vue2-perfect-scrollbar@npm:1.5.56 doesn't provide postcss (p1eb85), requested by cssnano
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 929ms
➤ YN0000: ┌ Fetch step
➤ YN0001: │ Error: Couldn't allocate enough memory
    at ZipFS.allocateBuffer ([worker eval]:1:40417)
    at ZipFS.allocateSource ([worker eval]:1:40853)
    at ZipFS.setFileSource ([worker eval]:1:41127)
    at ZipFS.writeFileSync ([worker eval]:1:46194)
    at extractArchiveTo ([worker eval]:1:461043)
    at async MessagePort.<anonymous> ([worker eval]:1:461794

  1. Support Staff 1 Posted by Owen McDonnell on 22 Mar, 2024 09:13 PM

    Owen McDonnell's Avatar

    Can you link to the build and post your yaml config file?

  2. 2 Posted by Nic on 25 Mar, 2024 01:07 PM

    Nic's Avatar

    LINK:
    https://ci.appveyor.com/project/Website/fe-dev-qa-sc10/builds/49464926

    YAML CONFIG FILE:

    version: 1.1.{build}
    branches:
      only:
        - ${APPVEYOR_REPO_BRANCH}
    skip_branch_with_pr: true
    image: Visual Studio 2022
    shallow_clone: true
    force_https_clone: true
    clone_folder: C:\dev\coveo-website
    init:
      - pwsh: >-
          npm i -g corepack@0.18.0
          
          corepack prepare yarn@3.3.0 --activate
    install:
      - pwsh: yarn install
    cache: .yarn
    build_script:
      - cmd: >-
          npm run appveyor:frontend
          
          cd C:\
          
          xcopy C:\_artifacts %APPVEYOR_BUILD_FOLDER%\_artifacts /S /i /Q
          
          
          7z a _artifacts.zip %APPVEYOR_BUILD_FOLDER%\_artifacts
          
          
          appveyor PushArtifact _artifacts.zip
    test: off
    artifacts:
      - path: _artifacts
        name: ArtifactsToDeploy
    deploy:
      - provider: Environment
        name: ${APPVEYOR_ENV}
    notifications:
      - provider: Slack
        incoming_webhook: https://hooks.slack.com/services/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
        channel: web-operations
        on_build_success: true
        on_build_failure: true
        on_build_status_changed: true

  3. Support Staff 3 Posted by Owen McDonnell on 25 Mar, 2024 09:45 PM

    Owen McDonnell's Avatar

    Can you give it a run without the newer yarn version, using instead what is pre-installed on Visual Studio 2022 image, and let us know if the same error crops up?

  4. 4 Posted by Nic on 26 Mar, 2024 06:40 PM

    Nic's Avatar

    I started a new project with Visual Studio 2022 image. Add the yarn install command in the Install script. The yarn install is not working.

    Fetching repository commit (f335805)...OK
    Total: 72.2 MB in 8874 files
    Running Install scripts
    yarn install
    npm run appveyor:frontend
    yarn install v1.22.19
    [1/4] Resolving packages...
    yarn : (node:5060) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
    At line:1 char:1
    + yarn install
    + ~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: ((node:5060) [DE...native instead.:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError


    (Use node --trace-deprecation ... to show where the warning was created)
  5. Support Staff 5 Posted by Owen McDonnell on 27 Mar, 2024 11:29 PM

    Owen McDonnell's Avatar

    The error there is apparently a bug in 1.22.19, which is the current version on those build images.
    Try adding - ps: npm install --global yarn to the install section of your config to update to 1.22.22 which apparently fixes this exact error.
    Also, regarding the original error from yarn 3.3.0, is this command working on your local machine? Could I get a link to the new project you made for testing, or any sort of public reproduction of this error?

  6. 6 Posted by Nic on 29 Mar, 2024 01:06 PM

    Nic's Avatar

    npm install --global yarn --force works. Packages installed successfully and build completed without issue.

    Do yo plan to migrate Yarn? (https://yarnpkg.com/migration/overview)

    This setup is working on our local machine.

    npm i -g corepack@0.18.0
          
    corepack prepare yarn@3.3.0 --activate
    
    yarn install
    
  7. Support Staff 7 Posted by Owen McDonnell on 09 Apr, 2024 10:59 PM

    Owen McDonnell's Avatar

    Sorry for the late reply. We looked into migrating yarn but it seems that installation via corepack is quite simple to add to a build's install stage and having yarn 1.x and 3.x on the same machine could be problematic for users with builds using node runtimes earlier than v18.

  8. Feodor Fitsner closed this discussion on 10 Jun, 2024 09:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

09 Jun, 2025 07:11 PM
04 Jun, 2025 04:08 PM
27 May, 2025 05:48 PM
27 May, 2025 06:37 AM
27 May, 2025 06:31 AM
20 May, 2025 02:54 PM