How to specify --max-old-space-size=8192 globally

If you wish to set the option globally --max-old-space-size=8192so that it is used when running all Node.js commands, you can do so by following these steps:

  1. Open a terminal or command line interface and run it with administrator privileges.

  2. Run the following command to set the global Node.js configuration:

    npm config set max-old-space-size 8192
    ```
    
    这将在您的计算机上设置全局 Node.js 配置,以便在运行 Node.js 命令时默认使用 `--max-old-space-size=8192` 选项。
    
    
  3. Confirm that the configuration was set up successfully. You can run the following command to check your current Node.js configuration:

    npm config get max-old-space-size
    

    If the command returns 8192, the global configuration was set successfully.

Note that the global configuration may affect the performance of all Node.js applications on your computer, so use this option with caution depending on your computer's configuration and available memory. If you're having trouble running certain Node.js applications, consider using the individual --max-old-space-sizeoption to tune for that application.

Guess you like

Origin blog.csdn.net/a772304419/article/details/131878775