新电脑配置了最新的node环境导致出现老项目打包失败提示
ReferenceError: primordials is not defined
解决方法:
1、安装nvm,node管理工具[可选]
windows系统下可以选择安装nvm:地址:点击链接
注:安装过程中选择node目录时如果已有node可以选择之前的目录。
2、下载安装老版本node
打开控制台一步到位降级到10+版本,我测试了12+的几个版本还是不行的。
nvm install v10.19.0
等待下载安装:
Downloading node.js version 10.19.0 (64-bit)...
Complete
Creating D:\Users\ASUS\AppData\Roaming\nvm\tempDownloading npm version 6.13.4... Complete
Installing npm v6.13.4...Installation complete. If you want to use this version, typenvm use 10.19.0
完成安装后运行给出的提示命令:
nvm use 10.19.0
即可
fe@1.0.0 build E:\Work\zelda-ui
> gulp build && gulp replace[18:11:52] Using gulpfile E:\Work\XXXX-ui\gulpfile.js
[18:11:52] Starting 'build:js'...
[18:11:52] Finished 'build:js' after 11 ms
[18:11:52] Starting 'build:css'...
[18:11:52] Finished 'build:css' after 2.21 ms
[18:11:52] Starting 'build:cdn'...
[18:11:52] Finished 'build:cdn' after 535 μs
[18:11:52] Starting 'build'...
[18:11:52] Finished 'build' after 32 μs
[18:11:58] Using gulpfile E:\Work\XXXX-ui\gulpfile.js
[18:11:58] Starting 'replace'...
[18:11:58] Finished 'replace' after 48 ms
参考:
https://blog.csdn.net/yym836659673/article/details/104847572/
https://blog.csdn.net/sunny_desmond/article/details/107506626