我想为我的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中设置的环境代码
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts",
"qa": "environments/environment.qa.ts"
}在环境/环境中。
export const environment = {
production: false
};发布于 2017-09-11 11:42:27
类型记录可能希望读取一个不存在的源文件。堆栈跟踪没有提到丢失文件的名称,但是您可以通过编辑文件node_modules\typescript\lib\typescript.js来获得它--在createSourceFile方法的开头添加一个日志语句console.log(fileName);,然后再次运行build命令。错误之前的最后一个文件名应该是导致问题的文件名。
发布于 2017-09-11 11:33:21
看起来,我们在environments/environment.qa.ts中设置了envName
export const environment = {
production: false,
envName: 'qa'
};你能试试这个吗?请参考这个文档使用环境.选项。
https://stackoverflow.com/questions/46154278
复制相似问题