Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular应用程序无法使用GitHub操作生成(';找不到模块';)_Angular_Typescript_Git_Github Actions - Fatal编程技术网

Angular应用程序无法使用GitHub操作生成(';找不到模块';)

Angular应用程序无法使用GitHub操作生成(';找不到模块';),angular,typescript,git,github-actions,Angular,Typescript,Git,Github Actions,我能够在本地构建项目(使用GitHub操作使用的构建命令)。但是,在管道中运行时,它会失败,并出现以下错误(还有更多错误,但基本上都是相同的错误) 它无法解析我导入到组件中的某些文件。它说“找不到模块”,但这些只是typescript接口文件,它们不在模块中。我不熟悉GitHub操作&真的不知道如何开始调试这种类型的问题 这是我的actions.yml文件 # This is a basic workflow to help you get started with Actions name:

我能够在本地构建项目(使用GitHub操作使用的构建命令)。但是,在管道中运行时,它会失败,并出现以下错误(还有更多错误,但基本上都是相同的错误)

它无法解析我导入到组件中的某些文件。它说“找不到模块”,但这些只是typescript接口文件,它们不在模块中。我不熟悉GitHub操作&真的不知道如何开始调试这种类型的问题

这是我的actions.yml文件

# This is a basic workflow to help you get started with Actions

name: Build

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  # pull_request:
  #   branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    name: Build
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Checkout Repo
        uses: actions/checkout@v2
        with:
          ref: master

      - name: Setup Node
        uses: actions/setup-node@v2-beta
        with:
          node-version: '10'

      - name: Cache node modules
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          # npm cache files are stored in `~/.npm` on Linux/macOS
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

      - name: Install Dependencies
        run: npm install

      - name: Build Project
        run: npm run build-prod

npm脚本
buildprod
转换为
ngbuild--prod
。同样,这个命令在本地是成功的,只是在GitHub操作中没有成功。

这看起来非常像这个问题中的相同问题:


我刚刚遇到了和你一样的问题,这个问题为我解决了。

哇,是的,这解决了我的问题。对其他人来说……这是一个套管问题。我从“../shared/models/view models/NewUserRequest”中导入了类似于
import{NewUserRequest}的语句,但文件名为
NewUserRequest.ts
。更新这些导入语句解决了生成问题
# This is a basic workflow to help you get started with Actions

name: Build

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  # pull_request:
  #   branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    name: Build
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Checkout Repo
        uses: actions/checkout@v2
        with:
          ref: master

      - name: Setup Node
        uses: actions/setup-node@v2-beta
        with:
          node-version: '10'

      - name: Cache node modules
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          # npm cache files are stored in `~/.npm` on Linux/macOS
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

      - name: Install Dependencies
        run: npm install

      - name: Build Project
        run: npm run build-prod