账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    Ionic3项目可以serve但是build会报错大概是什么原因?
    32
    0

    一个angular-ionic开发的项目,用ionic serve命令运行没有任何问题,但是一旦想用ionic build --prod命令打包就开始报错。这种情况一般都是由于什么原因引起的?有没有大佬指点一下。

    报错的内容:

    [09:26:18] ionic-app-script task: "build"
    [09:26:18] Error: Encountered undefined provider! Usually this means you have a circular dependencies (might be caused

            by using 'barrel' index.ts files.

    Error: Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.

    at syntaxError (E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:1550:34)
    at E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:14936:40
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver._getProvidersMetadata (E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:14921:19)
    at CompileMetadataResolver.getNgModuleMetadata (E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:14576:50)
    at addNgModule (E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:23050:58)
    at E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:23061:14
    at Array.forEach (<anonymous>)
    at _createNgModules (E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:23060:26)
    at analyzeNgModules (E:\abcd\node_modules\@angular\compiler\bundles\compiler.umd.js:22935:14)

    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! ionic-hello-world@0.0.0 ionic:build: ionic-app-scripts build
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the ionic-hello-world@0.0.0 ionic:build script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    检查了所有的module,并没有出现循环依赖。不过项目在最近改用了Ionic3的懒加载重新弄了路由,不知道是不是和这个有点关系

    2
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 红妆浓愁忆思牵。 普通会员 1楼

      在 Ionic3 项目中,当你尝试通过 ionic serve 命令来启动服务时,可能会遇到一些错误。这些错误可能是因为各种原因造成的,以下是一些可能的原因和解决方案:

      1. 缺少 ionic serve 命令:请确保你已经安装了 ionic serve 命令。如果还没有安装,可以通过 npm install -g @ionic/cli 命令来安装。

      2. 安装依赖:请确保你已经安装了所有依赖项。可以通过运行以下命令来安装:

      npm install --save @ionic/cli npm install --save @ionic/core npm install --save @ionic/app-scripts

      1. 缺少 Cordova CLI:请确保你已经安装了 Cordova CLI。如果没有安装,可以通过运行以下命令来安装:

      npm install -g cordova

      1. 使用不正确的配置文件:请确保你使用的是正确的配置文件。可以通过运行以下命令来检查配置文件:

      ionic info

      1. 服务未启动:请确保服务已经启动。可以通过运行以下命令来启动服务:

      ionic serve

      1. 确保在服务器上运行:请确保服务是在服务器上运行的。可以通过运行以下命令来检查服务器状态:

      ionic serve -v

      1. 使用错误的 cordova CLI 版本:请确保你使用的 cordova CLI 版本与你的项目版本兼容。可以通过运行以下命令来检查 cordova CLI 版本:

      ionic info -- cordova --version

      如果以上步骤都无法解决问题,你可能需要更深入地检查你的项目,找出问题的原因并进行修复。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部