首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >角2 CLI环境设置

角2 CLI环境设置
EN

Stack Overflow用户
提问于 2017-09-11 11:09:30
回答 2查看 154关注 0票数 1

我想为我的Range2项目建立开发、测试(QA)和PROD环境。在使用QA env时设置ng build --environment=qa

我的错误越来越少

无法读取未定义的属性的“长度”(D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15457:109) at WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15389:26) at parseSourceFileWorker ) (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15389:26) at Object.parseSourceFile ) (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15338:26 )WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15192:29) at VirtualFileStats.getSourceFile (D:\ECC Web\ECC在WebpackCompilerHost.getSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\@ngtools\webpack\src\compiler_ )WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67909:29) at processImportedModules (D:\ECC Web\ECC at findSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67937:17) )WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67840:27) at processRootFile (D:\ECC Web\ECC at D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67018:60 at Object.forEach (D:\ECC Web )\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:1449:30) at WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67018:16) at Object.createProgram (D:\ECC Web\ECC at AotPlugin._setupOptions ) (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\@ngtools\webpack\src\plugin.js:129:28) at new AotPlugin (D:\ECC Web )ECC WEB\working\8-Aug\node_modules\@ngtools\webpack\src\plugin.js:26:14)

下面是在角-cli.json中设置的环境代码

代码语言:javascript
复制
"environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts",
        "qa": "environments/environment.qa.ts"
      }

在环境/环境中。

代码语言:javascript
复制
export const environment = {
    production: false
  };
EN

回答 2

Stack Overflow用户

发布于 2017-09-11 11:42:27

类型记录可能希望读取一个不存在的源文件。堆栈跟踪没有提到丢失文件的名称,但是您可以通过编辑文件node_modules\typescript\lib\typescript.js来获得它--在createSourceFile方法的开头添加一个日志语句console.log(fileName);,然后再次运行build命令。错误之前的最后一个文件名应该是导致问题的文件名。

票数 2
EN

Stack Overflow用户

发布于 2017-09-11 11:33:21

看起来,我们在environments/environment.qa.ts中设置了envName

代码语言:javascript
复制
export const environment = {  
        production: false,
        envName: 'qa'
 };

你能试试这个吗?请参考这个文档使用环境.选项

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46154278

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档