Ionic app,错误:..main.ts模块构建失败:错误:ENOENT

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ionic app,错误:..main.ts模块构建失败:错误:ENOENT相关的知识,希望对你有一定的参考价值。

在这里,我有使用Firebase和Google集成的Ionic v4应用程序

离子信息显示:

Ionic:
   ionic (Ionic CLI)  : 4.12.0 (C:UsersxxxAppDataRoaming
vmv10.15.3
ode_modulesionic)
   Ionic Framework    : ionic-angular 3.9.3
   @ionic/app-scripts : 3.2.3

Cordova:
   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 22 other plugins)

System:
   NodeJS : v10.15.3 (C:Program Files
odejs
ode.exe)
   npm    : 6.4.1
   OS     : Windows 10

Main.ts包含这个

 {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);

运行后出现问题:ionic build android

[15:54:08]  ionic-app-script task: "build"
[15:54:08]  Error: C:/PATH/Ionic/src/app/main.ts Module build failed: Error: ENOENT: no
            such file or directory, open 'C:PATHIonicsrcappmain.js'
Error: C:/Users/Jasko/Dropbox/Projects/Real.Me/Ionic/src/app/main.ts
Module build failed: Error: ENOENT: no such file or directory, open 'C:PATHIonicsrcappmain.js'
    at new BuildError (C:PATHIonic
ode_modules@ionicapp-scriptsdistutilerrors.js:16:28)
    at callback (C:PATHIonic
ode_modules@ionicapp-scriptsdistwebpack.js:121:28)
    at emitRecords.err (C:PATHIonic
ode_moduleswebpacklibCompiler.js:265:13)
    at Compiler.emitRecords (C:PATHIonic
ode_moduleswebpacklibCompiler.js:371:38)
    at emitAssets.err (C:PATHIonic
ode_moduleswebpacklibCompiler.js:258:10)
    at applyPluginsAsyncSeries1.err (C:PATHIonic
ode_moduleswebpacklibCompiler.js:364:12)
    at next (C:PATHIonic
ode_modules	apablelibTapable.js:218:11)
    at Compiler.compiler.plugin (C:PATHIonic
ode_moduleswebpacklibperformanceSizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (C:PATHIonic
ode_modules	apablelibTapable.js:222:13)
    at Compiler.afterEmit (C:PATHIonic
ode_moduleswebpacklibCompiler.js:361:9)
[ERROR] An error occurred while running subprocess ionic-app-scripts.

谁知道在哪里寻找错误?

答案

该问题是由Windows Symlink文件夹引起的。一旦我将源代码移动到另一个驱动器,它就成功运行了。绝对是一个离子BUG

以上是关于Ionic app,错误:..main.ts模块构建失败:错误:ENOENT的主要内容,如果未能解决你的问题,请参考以下文章

Typescript es6导入模块“文件不是模块错误”

Ionic 2 build 抱怨不能模块 lodash

如何从 Ionic 5 中的@ionic/angular 错误修复成员事件

ionic 3 应用程序生成错误的 angular-select2 模块实现

ionic-app-script在构建时失败 - 无法找到模块'@ angular / compiler-cli / ngtools2'

Storybook main.ts:不能在模块外使用 import 语句