typeerror 相关问题

TypeError是将操作或函数应用于不适当类型的对象时引发的特定类型的错误。您可能会在Python或JavaScript中遇到它。

无法导入 CoolProp

我是编程新手,昨天才开始 也许这是非常基本的 我想导入coolProp来输入Cp和Cv值,但是当我输入: 导入 CoolProp.CoolProp 作为 CP 它显示以下

回答 1 投票 0

类型错误:/ 不支持的操作数类型:“list”和“int”

我收到以下错误: / 不支持的操作数类型:“list”和“int” 我该如何解决这个问题?任何想法? 这是我的代码: def func(xdata_1,cc,dd,gg): 返回 cc*(xdata_1**(dd))...

回答 2 投票 0

SlidesJS - TypeError:$(...).slidesjs 不是函数

我正在尝试在我的网站上实现 SlidesJS 插件,但是当页面加载时,我收到以下错误: 类型错误:$(...).slidesjs 不是函数 我的html是: ... 我正在尝试在我的网站上实现 SlidesJS 插件,但是当页面加载时,我收到以下错误: TypeError: $(...).slidesjs is not a function 我的html是: <div class="slider"> <div class="container"> <div id="slides"> <img src="<?= img('slides/example-slide-1.jpg') ?>" alt="photo 1"> <img src="<?= img('slides/example-slide-2.jpg') ?>" alt="photo 2"> <img src="<?= img('slides/example-slide-3.jpg') ?>" alt="photo 3"> <img src="<?= img('slides/example-slide-4.jpg') ?>" alt="photo 4"> <a href="#" class="slidesjs-previous slidesjs-navigation"><i class="icon-chevron-left icon-large"></i></a> <a href="#" class="slidesjs-next slidesjs-navigation"><i class="icon-chevron-right icon-large"></i></a> </div> </div> </div> 我的CSS文件包含: .slider #slides { display: none; } 我的js文件包含: $(document).ready(function() { ... $("#slides").slidesjs({ width: 1000, height: 290 }); } 我已经包含了 jQuery 和插件的特定脚本,但我仍然收到此错误。 我错过了什么吗? 我遇到了同样的问题,并通过将文件包含移动到页脚来解决它。 这对我不起作用。我已经尝试过上述解决方案。 粘贴在页脚部分

回答 2 投票 0

将 firebase 连接到我的 React 应用程序时出现错误

firebase config.js: 从“firebase/app”导入{initializeApp}; 从 'firebase/firestore/lite' 导入 { getFirestore}; 从“firebase/auth...

回答 1 投票 0

setter 给出“typeError:不是函数”

我将道具从父级 MoneyOut 传递到子级 AddSupliers,然后从该子级传递到使用它的另一个子级 SupplyNameCompont,这些道具已被解构。首先,表单工作......

回答 1 投票 0

为什么我会收到此类型错误:在字符串格式化过程中并非所有参数都已转换?

numbers = input ('请输入数字') 如果数字 % 2 == 0 : print('偶数') 别的: 打印(‘奇数’) 类型错误:字符串格式化期间并非所有参数都已转换 我想写一个

回答 1 投票 0

Super 表达式必须为 null 或函数 nextjs 13

当我导入时 从“react-responsive-carousel”导入{Carousel}; 并像下面这样使用它: 当我导入时 import { Carousel } from "react-responsive-carousel"; 并像下面这样使用它: <Carousel autoPlay infiniteLoop showStatus={false} showIndicators={false} showThumbs={false} interval={5000} ></Carousel> TypeError: Super expression must either be null or a function, not undefined 我希望在我的网站上出现横幅轮播 添加use client对我有用。这是代码片段。我正在使用 Next.js 13 和 Typescript 'use client' import React from 'react' import { Carousel } from 'react-responsive-carousel' type Props = {} function Banner({}: Props) { return ( <div className='relative'> <Carousel autoPlay infiniteLoop showStatus={false} showThumbs={false} interval={5000} > <div> <img loading='lazy' src="" alt='' /> </div> <div> <img loading='lazy' src="" alt='' /> </div> <div> <img loading='lazy' src="" alt='' /> </div> </Carousel> </div> ) } export default Banner 看来使用Carousel组件的react组件应该是客户端组件而不是服务器组件。这是使用指令“use client”完成的。在 React 18 中,app 目录中的组件默认是服务器组件。 尚不清楚为什么它不能从服务器组件运行。 可能最好在他们的 github 项目上创建一个问题 https://github.com/leandrowd/react-responsive-carousel/issues 从Next.js 13开始,app目录下的所有页面默认都是Server Component。 Server Component 不允许交互和事件侦听器(onClick、onChange 等)和使用状态和生命周期效果(useState、useEffect 等)。 无法使用react-responsive-carousel的原因可能是库内部使用了useState或useEffect或onClick和onChange事件监听器。 Next.js 官方文档已经指出了何时使用Server Component和Client Component 我刚刚通过在轮播组件顶部插入“使用客户端”来让 Next.js 和 React-responsive-carousel 协同工作。 这就是您上班时的样子: 'use client'; import React from 'react'; import Image from 'next/image'; import { Carousel } from 'react-responsive-carousel'; import 'react-responsive-carousel/lib/styles/carousel.min.css'; export default function MyCarousel() { return ( <Carousel autoPlay infiniteLoop showStatus={false} showIndicators={false} showThumbs={false} interval={5000} > <div> <img src='/image1.jpg' /> </div> <div> <img src='/image2.jpg' /> </div> </Carousel> ); } 我也面临同样的问题,因此在 Next Js 13 中,组件将“use Client”一词写入 String 解决这个问题 “使用客户端” "use client" import Image from 'next/image' import ReactPlayer from 'react-player' import { Carousel } from 'react-responsive-carousel'; import 'react-responsive-carousel/lib/styles/carousel.min.css'; export default function Home() { return ( <main className="flex min-h-screen flex-col items-center justify-between p-24"> <Carousel autoPlay infiniteLoop showStatus={false} interval={5000} > <div> <Image src='/image1.jpg' width={20} height={30} /> </div> <div> <Image src='/image2.jpg' width={20} height={30}/> </div> </Carousel> </main> ) } 对于反应响应轮播使用“使用客户端” "use client" import React from 'react' import { Carousel } from 'react-responsive-carousel'; import sliderImg_1 from '../images/slider/sliderImg_1.jpg'; import sliderImg_2 from '../images/slider/sliderImg_2.jpg'; import sliderImg_3 from '../images/slider/sliderImg_3.jpg'; import sliderImg_4 from '../images/slider/sliderImg_4.jpg' import Image from 'next/image'; const Banner = () => { return ( <Carousel> <div> <Image src={sliderImg_1} alt="slider-1" /> <p className="legend">Legend 1</p> </div> <div> <Image src={sliderImg_2} alt="slider-2" /> <p className="legend">Legend 2</p> </div> <div> <Image src={sliderImg_3} alt="slider-3"/> <p className="legend">Legend 3</p> </div> <div> <Image src={sliderImg_4} alt="slider-4"/> <p className="legend">Legend 3</p> </div> </Carousel> ) } export default Banner 通过“使用客户端”,您的整个文件将成为 CSR 如果你不想这样,请使用这个方法: 1.创建名为Carousel.tsx的文件 2.在下面写下这段代码 “使用客户端” 从“react-responsive-carousel”导入{Carousel}; 导出默认轮播; 3.然后在你的文件中: 从 ./Carousel 导入 Carousel; 现在它在服务器端工作,并且只有 Carousel 在 CSR 中

回答 7 投票 0

类型错误:无法获取mern

我正在学习“React、NodeJS、Express 和 MongoDB - MERN 全栈指南”课程“将 React.js 前端连接到后端”部分。谁能指导我为什么我会...

回答 2 投票 0

Next.js13 和 Contentlayer 语法-突出显示错误问题

在 Next.js13 上使用 tailwind、contentlayer 制作博客并进行语法高亮,尝试使用 rehype-pretty-code 和 rehype-highlight 库;但一些类型错误不断出现,而且我没有 ID...

回答 2 投票 0

使用 mpf.plot

我有我想玩的股票数据,我想我应该用 mpl 来绘制它。这是我尝试过的: 每日 = pd.read_csv('data/AAPL/history.csv',index_col=0,parse_dates=True) mpf.plot(每日) 这个

回答 1 投票 0

尝试使用mpl绘制数据框,遇到日期时间错误,不知道如何清理数据

我有我想玩的股票数据,我想我应该用 mpl 来绘制它。这是我尝试过的: 每日 = pd.read_csv('data/AAPL/history.csv',index_col=0,parse_dates=True) mpf.plot(每日) 这个

回答 1 投票 0

Pandas:类型错误:“str”和“int”实例之间不支持“>=”

我需要检查csv文件中的行差异并将比较结果写入新的csv。我有这段代码,它一直有效,直到我上传另一个文件,现在它给出了一个错误 - TypeError: '>='...

回答 1 投票 0

TypeError:在函数中打印时“NoneType”对象不可迭代

我在 Maya 2012 中遇到此错误,并且不知道如何修复,我试图让 python 在搜索文件夹中的其他文件时忽略 init 文件。任何建议将非常感激...

回答 2 投票 0

TypeError:“NoneType”对象不可使用递归函数进行迭代

我有一个函数“checkAllInOneDirection”,它是一个递归循环。当我跳出循环时,该函数返回 1 个数组和 3 个布尔值。最奇怪的是在递归函数中......

回答 2 投票 0

第三次运行函数后出现 TypeError

有人可以解释一下为什么我在第 21 行遇到 TypeError 吗: 回溯(最近一次调用最后一次): 文件“C:\Users-----\p.py”,第 57 行,位于 while check_int() != True 或 check_votes() !...

回答 1 投票 0

pdr。数据读取器 - 类型错误:字符串索引必须是整数

这段代码直到今天都运行良好。 现在我收到此错误消息:TypeError:字符串索引必须是整数 将 pandas_datareader 导入为 pdr Equity_Indices = ['^GSPC', 'ES=F', 'NQ=F', 'YM=F', ...

回答 4 投票 0

类型错误:products.data 未定义

我是 MERN 堆栈的初学者,我正在尝试从数据库中获取卡片详细信息并将其显示在卡片中。我收到此错误“TypeError:products.data 未定义”,在此之前,我收到 TypeError:produ...

回答 1 投票 0

类型错误:“int”类型的对象没有 len() 但正在使用 len()

我正在尝试制作一个始终为给定列表中的每个项目返回 True 的程序。但是,如果元素是单词“flick”,则切换为始终返回相反的布尔值。 笔记: “……

回答 1 投票 0

Python 类型错误:接受 0 个位置参数,但给出了 1 个位置参数(和 1 个仅关键字参数)

我遇到了一个奇怪的问题,上次我运行它时,它没有给出任何错误消息,但这次我运行了以下代码: x, sr = librosa.load('fyp/MER/Q3/MT0031951901.mp3') spectrum_centroids = librosa.fe...

回答 2 投票 0

无法匹配两个相同的类型

我真的不知道如何正确解决这个问题,因为我是伊德里斯的新手,所以我会讲我的故事。 我正在实现一个类型安全的 sprintf 函数,具有以下类型签名: sprintf : (s: Str...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.