【问题标题】:How to get rid of source-map-support TypeError: frame.getFileName is not a function in node 10如何摆脱 source-map-support TypeError: frame.getFileName is not a function in node 10
【发布时间】:2018-06-07 17:15:26
【问题描述】:

我刚从node 8 升级到node 10,我所有的量角器测试用例都失败了。

深入研究时,我发现源映射支持导致了问题。任何人都解决了它或有解决方法。

✗ encountered a declaration exception
  - TypeError: frame.getFileName is not a function
      at isInsideNodeModules (internal/util.js:360:28)
      at showFlaggedDeprecation (buffer.js:149:8)
      at new Buffer (buffer.js:174:3)
      at Array.<anonymous> (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:149:21)
      at /Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:53:24
      at mapSourcePosition (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:171:21)
      at wrapCallSite (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:343:20)
      at /Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:378:26
      at Array.map (<anonymous>)
      at Function.prepareStackTrace (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:377:24)

githubgithub isslue link 中也有一个问题,但有人有快速修复吗?

【问题讨论】:

    标签: node.js angular protractor


    【解决方案1】:

    您只需升级到 NodeJS 的 10.1.0 版本。

    这是版本 10.0.0 中的一个错误。

    【讨论】:

      【解决方案2】:

      如果使用 Babel 编译代码,我们找到了一种解决方法。将源映射从内联切换到文件为我们解决了这个问题。

      从以下位置更改 Babel 编译:

      babel --source-maps 内联

      babel --source-maps

      【讨论】:

      • 我没有使用 babel。我只使用内部使用 web pack 的 angular cli。
      • @AniruddhaDas 尝试将您的 webpack 开发工具更改为非内联 webpack.js.org/configuration/devtool
      【解决方案3】:

      如果您是 homebrew 用户,请运行以下命令将节点更新到最新版本:

      brew upgrade node
      

      这会将节点更新到最新版本。此问题已在最新版本中得到修复。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-11-20
        • 2017-10-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-04-13
        • 1970-01-01
        • 2020-01-18
        相关资源
        最近更新 更多