如何修复“ReferenceError: primordials is not defined"在 Node.js 中 [英] How to fix "ReferenceError: primordials is not defined" in Node.js
问题描述
我已经通过npm install"安装了 Node.js 模块,然后我尝试在命令提示符下执行 gulp sass-watch
.之后,我得到了以下回复.
I have installed Node.js modules by 'npm install', and then I tried to do gulp sass-watch
in a command prompt. After that, I got the below response.
[18:18:32] Requiring external module babel-register
fs.js:27
const { Math, Object, Reflect } = primordials;
^
ReferenceError: primordials is not defined
我之前尝试过这个gulp sass-watch
:
npm -g install gulp-cli
推荐答案
一分钟解决:
只需按照这些步骤.我使用的是 Windows 10,它非常适合我!
Fix it in one minute:
Just follow these steps. I'm on Windows 10 and it worked perfectly for me!
在您拥有
package.json
的同一目录中,创建一个npm-shrinkwrap.json
文件,其内容如下:
In the same directory where you have
package.json
create anpm-shrinkwrap.json
file with the following contents:
{
"dependencies": {
"graceful-fs": {
"version": "4.2.2"
}
}
}
运行npm install
,不用担心,它会用一堆内容更新npm-shrinkwrap.json
.
Run npm install
, and don't worry, it will update npm-shrinkwrap.json
with a bunch of content.
运行 gulp
以启动项目.
这篇关于如何修复“ReferenceError: primordials is not defined"在 Node.js 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!