npm编译cocos-creator/engine问题

通过阅读https://docs.cocos.com/creator/2.1/manual/zh/advanced-topics/engine-customization.html步骤安装的

~/Desktop/js
:arrow_forward: npm install -g gulp

~/Desktop/js
:arrow_forward: git clone https://github.com/cocos-creator/engine.git

~/Desktop/js
:arrow_forward: cd engine

Desktop/js/engine
:arrow_forward: npm install
npm WARN cocos-creator-js@1.7.0 No repository field.

audited 21675 packages in 4.906s

Desktop/js/engine
:arrow_forward: gulp build
fs.js:27
const { Math, Object } = primordials;
^

ReferenceError: primordials is not defined
at fs.js:27:26
at req_ (~/Desktop/js/engine/node_modules/natives/index.js:143:24)
at Object.req [as require] (~/Desktop/js/engine/node_modules/natives/index.js:55:10)
at Object. (~/Desktop/js/engine/node_modules/gulp-sourcemaps/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)

到最后一步编译不通过, 请问该如何解决?

1赞

遇到同样问题,请问怎么修改

兄弟解决了吗

没有 readme 文件,看你 clone 下来的仓库有没有问题

有README.md文件

截图看看

解法:NodeJS 降版

https://www.solutionfactory.in/posts/ReferenceError-primordials-is-not-defined-in-node-Solution

2赞

你这个链接被劫持了,跳转到那种两个人演的电影的网站了

使用nvm
直接安装11.15.0版本的node

好的谢谢,解决了