【问题标题】:graceful-fs warning messages each time when type npm每次键入 npm 时都会发出优美的 fs 警告消息
【发布时间】:2017-04-18 08:04:15
【问题描述】:

刚刚安装了 Node 6.9.1

npm - 3.10.8

当我输入 npm -v 时,我收到以下警告 re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

如何摆脱这条消息?

我试过npm uninstall graceful-fs -g
npm install -g graceful-fs graceful-fs@latest

然后输入npm list graceful-js -g 显示:

+-- ember-cli@2.6.0 | +-- bower-config@1.4.0 | | `-- graceful-fs@4.1.11 | `-- npm@2.15.1 | `-- graceful-fs@4.1.11 `-- graceful-fs@4.1.11

npm@2.15.1 使用的是 4.1.3 - 我认为这个版本不会退出。 graceful-fs。但我已经手动修复了。

在此之前我已经尝试过this commands

当输入 npm -v 时,cmd 仍然显示大约 5-6 个警告...

编辑

树依赖npm list graceful-js -g 不同的是我只是全局安装了grunt

+-- ember-cli@2.10.0 | +-- bower-config@1.4.0 | | `-- graceful-fs@4.1.11 | `-- npm@3.10.8 | `-- graceful-fs@4.1.6 +-- graceful-fs@4.1.11 `-- grunt@1.0.1 `-- dateformat@1.0.12 `-- meow@3.7.0 `-- read-pkg-up@1.0.1 `-- read-pkg@1.1.0 `-- load-json-file@1.1.0 `-- graceful-fs@4.1.11

编辑 2

npm la ember-cli -g之后的输出是:

Command line tool for developing ambitious ember.js apps
git+https://github.com/ember-cli/ember-cli.git
https://ember-cli.com/

【问题讨论】:

  • 试试npm uninstall ember-cli -gnpm install ember-cli -g。我认为以后的版本使用更新的依赖项,这应该可以缓解这个问题。
  • 还是一样的结果
  • 您能检查一下现在安装的是哪个版本的ember-cli 吗?
  • npm list ember-cli -g 显示-- ember-cli@2.10.0
  • 很奇怪,我本以为可以解决问题。您能否在您的问题中再次粘贴完整的依赖关系树?

标签: node.js npm


【解决方案1】:

经过15个小时的挖掘,我找到了解决方案:

  • 在您的桌面上下载通过testsgraceful-fs 的最新稳定版本。
  • 转到C:\Program Files\nodejs\node_modules\npm\node_modules
  • 找出哪些包正在使用graceful-fs。导航到他们的 node_modules 文件夹并手动替换为从 GitHub 下载的文件。
  • 对所有包执行此操作。

就我而言,我使用的是 3.0.8 版。

希望它可以帮助某人。

【讨论】:

    【解决方案2】:

    我目前的进度:

    刚刚制作了一个 C# 控制台应用程序来读取 Windows 中包含“graceful-fs”的所有文件。第一个结果非常有趣: C:\NVIDIA\DisplayDriver\375.70\Win10_64\International\nodejs\NVIDIA Web Helper.exe 包含 Javascript 代码和以下代码块:

    if (e.code !== 'MODULE_NOT_FOUND') {throw e};
    
    // TODO(ChALkeR): remove this in master after 6.x
    // This code was based upon internal/util and is required to give users
    // a grace period before actually breaking modules that re-evaluate fs
    // sources from context where internal modules are not allowed, e.g.
    // older versions of graceful-fs module.
    
    const prefix = `(${process.release.name}:${process.pid}) `;
    
    printDeprecation = function(msg, warned) {
    if (process.noDeprecation)
      return true;
    
    if (warned)
      return warned;
    
    if (process.throwDeprecation)
      throw new Error(`${prefix}${msg}`);
    else if (process.traceDeprecation)
      console.trace(msg);
    else
      console.error(`${prefix}${msg}`);
    
    return true;
    };
    printDeprecation('fs: re-evaluating native module sources is not ' +
                   'supported. If you are using the graceful-fs module, ' +
                   'please update it to a more recent version.',
                    false);
    

    我已经更新了 NVidia 驱动程序,但目前我正在搜索它们的安装位置。我开始怀疑警告是由驱动程序引起的。

    【讨论】:

      猜你喜欢
      • 2020-01-23
      • 1970-01-01
      • 2017-11-30
      • 2018-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-18
      • 1970-01-01
      相关资源
      最近更新 更多