如何修复“ReferenceError: primordials is not defined"在 Node.js 中 [英] How to fix "ReferenceError: primordials is not defined" in Node.js

查看:83
本文介绍了如何修复“ReferenceError: primordials is not defined"在 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!

  1. 在您拥有 package.json 的同一目录中,创建一个 npm-shrinkwrap.json 文件,其内容如下:

  1. In the same directory where you have package.json create a npm-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屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆