Angular new project, npm start fails with esbuild errors

Discussão em 'Angular' iniciado por Gaurav Nagpure, Janeiro 2, 2025.

  1. node: v18.20.2

    npm: 10.9.2

    angular-cli:19.0.6

    Create a project using angular cli and after running 'npm start' following error gets displayed in terminal.

    C:\Users\gnagpure\Documents\ng-19> npm start

    > ng-19@0.0.0 start
    > ng serve

    An unhandled exception occurred:
    You installed esbuild for another platform than the one you're currently using.
    This won't work because esbuild is written with native code and needs to
    install a platform-specific binary executable.

    Specifically the "@esbuild/win32-x64" package is present but this platform
    needs the "@esbuild/win32-x64" package instead. People often get into this
    situation by installing esbuild on Windows or macOS and copying "node_modules"
    into a Docker image that runs Linux, or by copying "node_modules" between
    Windows and WSL environments.

    If you are installing with npm, you can try not copying the "node_modules"
    directory when you copy the files over, and running "npm ci" or "npm install"
    on the destination platform after the copy. Or you could consider using yarn
    instead of npm which has built-in support for installing a package on multiple
    platforms simultaneously.

    If you are installing with yarn, you can try listing both this platform and the
    other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
    feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
    Keep in mind that this means multiple copies of esbuild will be present.

    Another alternative is to use the "esbuild-wasm" package instead, which works
    the same way on all platforms. But it comes with a heavy performance cost and
    can sometimes be 10x slower than the "esbuild" package, so you may also not
    want to do that.

    See "C:\Users\gnagpure\AppData\Local\Temp\ng-mw9SDM\angular-errors.log" for further details.
    PS C:\Users\gnagpure\Documents\ng-19>

    Continue reading...

Compartilhe esta Página