node.js - 我部署了我的项目,我收到此错误输入文件包含不受支持的图像格式

标签 node.js reactjs npm github-actions

我正在尝试在我的生产环境中构建(我使用 GitHub 操作进行部署),但错误是我本地的 Node 不一样

在我的本地我有这个版本:

npm -v
-> 7.24.1

node -v
-> v14.13.1

但我不知道GitHub actions上的node版本是多少 我无法在本地重现错误,因为版本不一样

我收到这个错误:

success extract queries from components - 4.464s
success write out redirect data - 0.001s
success Build manifest and related icons - 0.003s
error "gatsby-plugin-manifest" threw an error while running the onPostBootstrap lifecycle:

Input file contains unsupported image format


  Error:Input file contains unsupported image format

not finished onPostBootstrap - 0.025s
npm ERR! code ELIFECYCLE

这些是我的依赖项:

{
  "dependencies": {
    "@material-ui/core": "4.11.0",
    "@material-ui/icons": "4.9.1",
    "@material-ui/lab": "4.0.0-alpha.56",
    "@material-ui/styles": "4.11.4",
    "axios": "^0.21.0",
    "file-saver": "^2.0.5",
    "firebase": "^7.15.4",
    "gatsby": "^2.22.15",
    "gatsby-cli": "^2.12.87",
    "gatsby-image": "^2.4.5",
    "gatsby-plugin-manifest": "^2.4.9",
    "gatsby-plugin-material-ui": "3.0.0",
    "gatsby-plugin-react-helmet": "^3.3.2",
    "gatsby-plugin-react-redux": "1.1.0",
    "gatsby-plugin-react-svg": "^3.0.0",
    "gatsby-plugin-robots-txt": "^1.6.8",
    "gatsby-plugin-sharp": "^2.6.9",
    "gatsby-plugin-sitemap": "3.3.0",
    "gatsby-source-filesystem": "^2.3.8",
    "gatsby-transformer-sharp": "2.5.3",
    "material-ui-dropzone": "3.3.0",
    "npm": "^7.5.6",
    "prop-types": "^15.7.2",
    "react": "^16.13.1",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5",
    "redux-mock-store": "^1.5.4",
    "stopword": "^1.0.3",
    "tracking-number-validation": "^2.0.2",
    "uuid": "^8.3.2"
  },
}

这是要部署到生产环境的 build.yml

name: Build

on:
  push:
    branches:
      - master

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v2
  deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - run: echo ${{ github.ref }}
      - name: Checkout Repo
        uses: actions/checkout@v2
      

最佳答案

but i dont know what is the node version on github actions i can not reproduce the error in my local, because of the version are not the same

您可以使用setup-node 操作使版本与您的本地版本完全相同:

- uses: actions/setup-node@v2
  with:
    node-version: '14.13.1'
- run: npm install -g npm@7.24.1
- run: npm -v
- run: node -v

github中的输出:

Run npm -v
  npm -v
  shell: /usr/bin/bash -e {0}
7.24.1
Run node -v
  node -v
  shell: /usr/bin/bash -e {0}
v14.13.1

关于node.js - 我部署了我的项目,我收到此错误输入文件包含不受支持的图像格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69400311/

相关文章:

angular - 测试 npm 是否通过 visual studio 2015 的代理连接

linux - `npm uninstall` 在没有明显事件的情况下挂起(或非常慢)

node.js - 如何将 compressjs 输出写入文件

javascript - mypromise.then 内函数的返回值

javascript - 为什么我可以将未知属性分配给 typescript 中的文字对象?

reactjs - react typescript : TS Error when using useReducer

javascript - 类型错误 : Cannot read properties of undefined (reading 'split' ) happened when I try to run "npm run compile"

mysql - SQL输出参数失败

node.js - 使用 nodejs 中的服务帐户域范围委托(delegate)通过 Google Apps Gmail 发送邮件

javascript - 使用 map() 方法动态 react 构建 href 文件 URL