简体   繁体   English

对于popper js typescript错误的反应应用程序构建失败

[英]React app build failed for popper js typescript error

I have react app that used bootstrap 4.3.1 as node modules.When i am building the app its giving below error TypeScript error in /codebuild/output/src478180495/src/app-name/node_modules/@popperjs/core/lib/createPopper.d.ts(1,13): '=' expected. TS1005 > 1 | import type { OptionsGeneric, Modifier, Instance, VirtualElement } from "./types";我有使用引导程序 4.3.1 作为节点模块的反应应用程序。当我构建应用程序时,它TypeScript error in /codebuild/output/src478180495/src/app-name/node_modules/@popperjs/core/lib/createPopper.d.ts(1,13): '=' expected. TS1005 > 1 | import type { OptionsGeneric, Modifier, Instance, VirtualElement } from "./types"; TypeScript error in /codebuild/output/src478180495/src/app-name/node_modules/@popperjs/core/lib/createPopper.d.ts(1,13): '=' expected. TS1005 > 1 | import type { OptionsGeneric, Modifier, Instance, VirtualElement } from "./types"; It was fine earlier.之前还好。 error coming up today.今天出现错误。

It is due to a new syntax introduced by Typescript type-only-imports-and-export这是由于 Typescript type-only-imports-and-export引入的新语法

Upgrade your typescript module in package.json to > 3.8.0 and @type definitions should solve this issue.将 package.json 中的typescript模块package.json到 > 3.8.0 和@type定义应该可以解决此问题。

Heres the related Stackoverflow topic.这是相关的Stackoverflow主题。

I ran into same problem while coding a web part for SPFx, which is slightly different, but since search led me here, so I'll leave the answer for anyone in the future.我在为 SPFx 编写 web 部件时遇到了同样的问题,这略有不同,但由于搜索将我带到了这里,所以我将在未来为任何人留下答案。

while updated typescript to 4.4 when running gulp serve i got typescript version: 3.7.7 .虽然在运行gulp serve时将 typescript 更新为 4.4,但我得到了typescript version: 3.7.7 Steps to remedy:补救措施:

  1. run npm i @microsoft/rush-stack-compiler-3.9 This variant selects TypeScript 3.9运行npm i @microsoft/rush-stack-compiler-3.9此变体选择 TypeScript 3.9
  2. in tsconfig.json change extends to "extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json",tsconfig.json更改extends"extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json",
  3. in tslint.json remove "no-use-before-declare": true, as it will cause error Error - [tslint] no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.tslint.json中删除"no-use-before-declare": true,因为它会导致错误Error - [tslint] no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead. Error - [tslint] no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:无法缩小popper.js - Error:Failed to minify popper.js Netlify 构建因 React 应用程序中的 npm 错误而失败 - Netlify build failed for npm error in react app 对象作为 React 子项无效 -> 构建时错误 -> next.js typescript - Objects are not valid as a React child -> Build time error -> next js typescript React-js MUI Tooltip 重叠 Popper - React-js MUI Tooltip overlapping Popper 创建反应应用程序 - 没有打字稿,得到错误:无法加载解析器'@typescript-eslint/parser' - create react app - without typescript , got Error: Failed to load parser '@typescript-eslint/parser' Popper.js React Wrapper - React.createElement:type无效 - Popper.js React Wrapper - React.createElement: type is invalid 在构建过程中反应,redux和打字稿错误 - react, redux and typescript error during build “编译失败”“解析错误:意外的令牌:”在尝试迁移到现有 create-react-app 中的 typescript 期间 - "Failed to Compile" "Parsing error: Unexpected token :" during attempt to migrate to typescript in existing create-react-app 尽管 TypeScript 编译器错误,为什么我的 React Native 应用程序构建成功? - Why does my React Native app build successfully despite TypeScript compiler error? Heroku - Node.js - React App - 构建失败 - “找不到文件” - Heroku - Node.js - React App - Build failed - “Cannot find file”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM