首页
Javascript
Html
Css
Node.js
Electron
移动开发
小程序
工具类
服务端
浏览器相关
前端收藏
其他
关于
公司注册

目录

macbook m1下webpack启动慢(npm run dev,npm run build),慢的怀疑人生

2021年12月19日 发布 阅读(2597) 作者:Jerman

原因

说到底还是NODE版本的问题,装 x86版就没问题了,快的一批

前端it人,基本都用 NVM,具体可参考: https://github.com/nvm-sh/nvm

使用nvm重新安装node,如果已经安装,请先uninstall

  1. # Check what version you're running:
  2. $ node --version
  3. v14.15.4
  4. # Check architecture of the `node` binary:
  5. $ node -p process.arch
  6. arm64
  7. # This confirms that the arch is for the M1 chip, which is causing the problems.
  8. # So we need to uninstall it.
  9. # We can't uninstall the version we are currently using, so switch to another version:
  10. $ nvm install v12.20.1
  11. # Now uninstall the version we want to replace:
  12. $ nvm uninstall v14.15.4
  13. # Launch a new zsh process under the 64-bit X86 architecture:
  14. $ arch -x86_64 zsh
  15. # Install node using nvm. This should download the precompiled x64 binary:
  16. $ nvm install v14.15.4
  17. # Now check that the architecture is correct:
  18. $ node -p process.arch
  19. x64
  20. # It is now safe to return to the arm64 zsh process:
  21. $ exit
  22. # We're back to a native shell:
  23. $ arch
  24. arm64
  25. # And the new version is now available to use:
  26. $ nvm use v14.15.4
  27. Now using node v14.15.4 (npm v6.14.10)
版权声明:本站文章除特别声明外,均采用署名-非商业性使用-禁止演绎 4.0 国际 许可协议,如需转载,请注明出处