node不要使用最新版本,使用LTS版本

错误现象

const { Math, Object, Reflect } = primordials;

原因

使用了最新的node版本

解决

使用稳定版本,参考官网说明,目前10.x的版本是稳定版本(LTS)

yarn的使用

避免和npm混用

安装

  • 推荐:npm install -g yarn
  • 不推荐:brew install yarn会覆盖node版本,安装最新的node版本(不是LTS版本),安装的node版本不够稳定

homebrew安装指定版本的node

brew search node然后选择一个node版本

参考

https://yarnpkg.com/zh-Hans/docs/install#mac-stable

https://blog.csdn.net/yw00yw/article/details/81354533

猜你喜欢

转载自www.cnblogs.com/shengulong/p/11609914.html