gpt4 book ai didi

javascript - 即使安装依赖项后,我的代码也不会呈现

转载 作者:行者123 更新时间:2023-12-02 23:34:21 25 4
gpt4 key购买 nike

编译失败。

./src/components/Teachers.js找不到模块:无法解析“C:\Users\user\Documents\GitHub\Portfolio\Rework1\src\components”中的“semantic-ui-react”

我不断收到此错误,我的代码可以工作,但看起来我的依赖项未正确加载,我运行了一些终端命令,这些命令破坏了我的代码,请帮忙。

我尝试在 Node_Modules 文件夹中安装依赖项

import React from 'react';
import TeacherList from '../data/teachers';
import { Badge, CardHeader,CardImg, CardFooter, CardBody,
CardText,CardColumns,CardTitle,CardSubtitle,Row,Col, } from 'reactstrap';
import { Button, Header, Modal } from 'semantic-ui-react'

import { Card, Icon, Image } from 'semantic-ui-react'

import Description from './Description'
const Teachers = () => {
let teachers = TeacherList.map((teacher) => {
return (

<img className="teacher-img" src={teacher.img_src} alt="teacher" />
<b className="projectTitle">{teacher.name}</b>
<hr className="divider2 my-4"/>

<a className="link" href={teacher.code} target="_blank" rel="noopener noreferrer"><b> Code </b></a>
<a className="link code" href={teacher.live} target="_blank" rel="noopener noreferrer"><b> Live </b></a>
<CardFooter>
<Badge color="primary" pill>{teacher.javascript}</Badge>
<Badge color="secondary" pill>{teacher.html5}</Badge>
<Badge color="success" pill>{teacher.bootstrap}</Badge>
<Badge color="info" pill>{teacher.css3}</Badge>
<Badge color="light ">{teacher.jquery}</Badge>




</CardFooter>
</Card> */}
<Card>
<div className="container3">
<Image src={teacher.img_src} wrapped ui={false} />
<Card.Content>
<Card.Header>Daniel</Card.Header>
<Card.Meta>Joined in 2016</Card.Meta>
<Card.Description>
Daniel is a comedian living in Nashville.
</Card.Description>
</Card.Content>
<Card.Content extra>
<a>
<Icon name='user' />
10 Friends
</a>
</Card.Content>
</div>

</Card>

</div>



);
});

return (
<div className="main-content">
<h2>Projects </h2>
<ul className="group">
{teachers}
</ul>
</div>
);
}

export default Teachers;

Package.Json

{
"name": "course-directory",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "1.0.6"
},
"dependencies": {
"bootstrap": "^4.3.1",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-router-dom": "^5.0.0",
"semantic-ui": "^2.4.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}

最佳答案

尝试执行 npm i -S语义-ui-react

-S 是一个保存标志,会将其保存到 package.json 中我看不到的依赖项中。

如果这不起作用,请尝试删除您的 node_modules 文件夹并使用 npm i 重新安装

关于javascript - 即使安装依赖项后,我的代码也不会呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56349273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com