首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >@react-pdf构建失败的Reactjs:./node_modules/@react-pdf/png-js/lib/png-js.browser.es.js

@react-pdf构建失败的Reactjs:./node_modules/@react-pdf/png-js/lib/png-js.browser.es.js
EN

Stack Overflow用户
提问于 2022-11-05 04:14:36
回答 1查看 431关注 0票数 1

代码没有变化。昨天,应用程序成功地完成了构建。但今天它没能建造

似乎是一些问题的反应-pdf依赖。

./node_modules/@react-pdf/png-js/lib/png-js.browser.es.js 10116:106个模块解析失败:意外令牌(10116:106个)文件是用这些加载程序处理的:

  • ./node_modules/babel-loader/lib/index.js您可能需要一个额外的加载程序来处理这些加载程序的结果。*/

函数gen_bitlen(s,desc) /* deflate_state s;/ /* tree_desc desc;/树描述符//{ var tree = desc.dyn_tree;

节点版本: v14.16.0 NPM版本: 6.14.11

我的package.json详细信息如下:

代码语言:javascript
复制
{
  "name": "command-center",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@chakra-ui/icons": "^1.0.11",
    "@chakra-ui/react": "^1.4.1",
    "@emotion/react": "^11.1.5",
    "@emotion/styled": "^11.1.5",
    "@react-pdf/renderer": "2.1.1",
    "@react-pdf/font": "2.2.0",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "chart.js": "^3.3.0",
    "compressorjs": "^1.0.7",
    "exceljs": "^4.2.1",
    "file-saver": "^2.0.5",
    "framer-motion": "^4.1.11",
    "html-to-image": "^1.6.2",
    "html2canvas": "^1.0.0-rc.7",
    "jspdf": "^2.3.1",
    "query-string": "^7.0.0",
    "react": "^17.0.2",
    "react-chartjs-2": "^3.0.3",
    "react-datepicker": "^3.8.0",
    "react-dom": "^17.0.2",
    "react-google-charts": "^3.0.15",
    "react-icons": "^4.2.0",
    "react-icons-kit": "^2.0.0",
    "react-modern-calendar-datepicker": "^3.1.6",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-to-print": "^2.12.6",
    "web-vitals": "^1.0.1",
    "xlsx": "^0.16.9"
  },
  "resolutions": {
    "@react-pdf/font": "2.2.0"
  },
  "scripts": {
    "start": "set PORT=3143 && react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

在这个问题上寻求帮助。

尝试改变的版本反应-pdf npm。但这没什么用。

EN

回答 1

Stack Overflow用户

发布于 2022-11-06 03:36:28

你能把react脚本版本从4.0.3降到4.0.1吗?如果这不起作用,你也可以通过将babel版本降级到7.19.x来检查它。

许多其他人发布了类似的问题。

Module parse failed: Unexpected token (257:106) You may need an appropriate loader to handle this file type (请查看评论,这可能是原因)

React App: "Module parse failed: Unexpected token"

https://github.com/facebook/create-react-app/issues/10518

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74325047

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档