部署到 Azure Linux 我得到的 Web 应用程序 要导入 Sass 文件,首先需要安装 node-sass

Deploying to Azure Linux Web App I get To import Sass files, you first need to install node-sass

当我将使用 Create-React-App 创建的 React 应用程序部署到 Linux 上的 Azure Web 应用程序时,当我浏览该网站时出现以下信息?

要导入Sass个文件,首先需要安装node-sass.

当我在本地 运行 时一切正常(运行 来自 Mac)。我检查了 DevOps 部署日志,报告它安装了 node-sass 没有问题。我还尝试删除 node_modules 和 npm install 中的 node-sass 文件夹。这再次添加了 node-sass 没有问题,但我仍然收到错误?

有没有人以前遇到过这个问题或有什么建议?

这是 Yaml 文件。

# Node.js React Web App to Linux on Azure
# Build a Node.js React app and deploy it to Azure as a Linux web app.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

variables:

  # Azure Resource Manager connection created during pipeline creation
  azureSubscription: '<Remove for Security>'

  # Web app name
  webAppName: '<Remove for Security>'

  # Environment name
  environmentName: '<Remove for Security>'

  # Agent VM image name
  vmImageName: 'ubuntu-latest'

stages:
- stage: Build
  displayName: Build stage
  jobs:  
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
        includeRootFolder: false
        archiveType: zip
        archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        replaceExistingArchive: true

    - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      artifact: drop

- stage: Deploy
  displayName: Deploy stage
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: Deploy
    displayName: Deploy
    environment: $(environmentName)
    pool: 
      vmImage: $(vmImageName)
    strategy:
      runOnce:
        deploy:
          steps:            
          - task: AzureRmWebAppDeployment@4
            displayName: 'Azure App Service Deploy: <Remove for Security>'
            inputs:
              azureSubscription: $(azureSubscription)
              appType: webAppLinux
              WebAppName: $(webAppName)
              packageForLinux: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
              RuntimeStack: 'NODE|10.10'
              StartupCommand: 'npm run start'
              ScriptType: 'Inline Script'
              InlineScript: |
                npm install
                npm run build --if-present

我对另一个节点包也有类似的问题。在节点包未得到解析的情况下,请尝试使用 -g 标志全局安装节点包。