Node.js 错误:无法读取配置文件newrelic.js

Node.js 错误:无法读取配置文件newrelic.js,node.js,webpack,newrelic,angular-universal,Node.js,Webpack,Newrelic,Angular Universal,我得到了这个错误: Error: Unable to read configuration file newrelic.js. A base configuration file can be copied from 536 and renamed to in the directory from which you will start your application. 该项目是带有SSR的Angular 7 SPA。有两种解决方案: 第一个是由bj97301于 在我的网页包配置文件中

我得到了这个错误:

Error: Unable to read configuration file newrelic.js. 
A base configuration file can be copied from 536 and renamed to in the 
directory from which you will start your application.
该项目是带有SSR的Angular 7 SPA。

有两种解决方案: 第一个是由bj97301于

  • 在我的网页包配置文件中,将newrelic设置为外部:

    外部:['newrelic']

  • 在我的网页包配置文件中,使用commonjs作为我的输出库目标:

    输出:{libraryTarget:'commonjs'}

  • 将newrelic.js更改为使用导出。而不是出口:

    was:导出常量配置={

    现在:exports.config={

  • 如果您想部署一个完整的包来删除服务器,因为您排除了newrelic包,那么这种方法将不起作用。 要解决这个问题,可以使用第二种方法。 作为一种解决方法,将newrelic.js更改为覆盖环境变量,而不是导出配置

    e、 g

    您可以删除导出的原始配置:

    'use strict';
    exports.config = {
      app_name: [],
      license_key: '',
      logging: {
        level: 'warning'
      },
      allow_all_headers: true
      }
    
    不要忘记在服务器上要求。ts,只需添加:

    require('./newrelic');
    
    我希望这能节省一些时间。

    有两种解决方案: 第一个是由bj97301于

  • 在我的网页包配置文件中,将newrelic设置为外部:

    外部:['newrelic']

  • 在我的网页包配置文件中,使用commonjs作为我的输出库目标:

    输出:{libraryTarget:'commonjs'}

  • 将newrelic.js更改为使用导出。而不是导出:

    was:导出常量配置={

    现在:exports.config={

  • 如果您想部署一个完整的包来删除服务器,因为您排除了newrelic包,那么这种方法将不起作用。 要解决这个问题,可以使用第二种方法。 作为一种解决方法,将newrelic.js更改为覆盖环境变量,而不是导出配置

    e、 g

    您可以删除导出的原始配置:

    'use strict';
    exports.config = {
      app_name: [],
      license_key: '',
      logging: {
        level: 'warning'
      },
      allow_all_headers: true
      }
    
    不要忘记在服务器上要求。ts,只需添加:

    require('./newrelic');
    
    我希望这能节省一些时间