1. 1. Npm install failed with “cannot run in wd”
  2. 2. FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Npm install failed with “cannot run in wd”

  1. Run npm install with the --unsafe-perm flag:

    1
    [sudo] npm install --unsafe-perm
  2. Add the unsafe-perm flag to your package.json:

    1
    2
    3
    "config": {
    "unsafe-perm":true
    }

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

  1. 增加Node JS内存。在您的VS Code终端中,键入:export NODE_OPTIONS="--max-old-space-size=8192"

    其中max-old-space-size的值可以是:2048、4096、8192、16384,依此类推

  2. 请尝试以下步骤:

    1. 删除node_modules文件夹。
    2. 删除package-lock.json文件。
    3. 重新安装node.js或更新到最新版本。
    4. 然后npm install

    如果此解决方案不起作用,请尝试解决方案1