Open fengchuanlin opened 9 months ago
作者您好,我遇到一个问题,就是我备份时会报错,这是怎么回事呢? 报错具体代码: npm run build
blog@0.1.0 构建 tsc && vite 构建
src/sections/About/index.tsx:5:19 - 错误 TS7016:找不到模块“react-reveal/Pulse”的声明文件。'C:/Users/123/Downloads/pengBlog-master/pengBlog-master/index/node_modules/react-reveal/Pulse.js' 隐式具有“any”类型。 尝试
npm i --save-dev @types/react-reveal
它是否存在或添加一个新的声明(.d.ts)文件,其中包含declare module 'react-reveal/Pulse';
5 从'react-reveal/Pulse'导入Pulse;
~~~~~src/sections/About/index.tsx:6:23 - 错误 TS7016:找不到模块“react-reveal/HeadShake”的声明文件。'C:/Users/123/Downloads/pengBlog-master/pengBlog-master/index/node_modules/react-reveal/HeadShake.js' 隐式具有“any”类型。 尝试
npm i --save-dev @types/react-reveal
它是否存在或添加一个新的声明(.d.ts)文件,其中包含declare module 'react-reveal/HeadShake';
6 从 'react-reveal/HeadShake' 导入 HeadShake;
~~~~~~~~src/sections/Home/index.tsx:8:22 - 错误 TS2307:找不到模块“./pagemore.json”或其相应的类型声明。
8 从“./pagemore.json”导入pageMore
~~~~~~src/sections/Project/index.tsx:43:60 - 错误 TS2322:类型 '{ className: string; 参考:MutableRefObject<HTMLDivElement | 空>; 替代:字符串;}' 不可分配给类型“DetailedHTMLProps<HTMLAttributes, HTMLDivElement>”。 类型“DetailedHTMLProps<HTMLAttributes, HTMLDivElement>”上不存在属性“alt”。
43
在 3 个文件中发现 4 个错误。 错误文件 2 src/sections/About/index.tsx:5 1 src/sections/Home/index.tsx:8 1 src/sections/Project/index.tsx:43
该问题解决了,是我太粗心啦。 需要在vite-env.d.ts 文件下添加类型。 添加上就完成了
作者您好,我遇到一个问题,就是我打包时会报ts的错,这个是怎么回事呢? 报错具体代码: npm run build
src/sections/About/index.tsx:5:19 - error TS7016: Could not find a declaration file for module 'react-reveal/Pulse'. 'C:/Users/123/Downloads/pengBlog-master/pengBlog-master/index/node_modules/react-reveal/Pulse.js' implicitly has an 'any' type. Try
npm i --save-dev @types/react-reveal
if it exists or add a new declaration (.d.ts) file containingdeclare module 'react-reveal/Pulse';
5 import Pulse from 'react-reveal/Pulse';
src/sections/Home/index.tsx:8:22 - error TS2307: Cannot find module './pagemore.json' or its corresponding type declarations.
8 import pageMore from "./pagemore.json"
Found 4 errors in 3 files.
Errors Files 2 src/sections/About/index.tsx:5 1 src/sections/Home/index.tsx:8 1 src/sections/Project/index.tsx:43