我开始学习React。我确实遵循了youtube上的一些教程,但是在添加https://react-bootstrap.github.io/时始终会遇到此问题。我确实遵守react-bootsrtap网站https://react-bootstrap.github.io/getting-started/introduction上提供的所有说明。
当我在控制台中npm-start时,我确实看到以下消息:
Failed to compile.
./src/components/Home.jsModule not found: Can't resolve 'react-bootsrtap' in 'C:\Users\Nikolay\desktop\testsite\nikolay\nick\src\components'
当我从代码中删除对引导程序的任何引用时,它可以正常编译。
Package.json如下所示(请注意包含了引导程序):
{
"name": "nick",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"bootstrap": "^3.4.1",
"react": "^16.13.1",
"react-bootstrap": "^1.0.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
请不要建议运行
npm install --save react-bootstrap bootstrap
代替
npm install react-bootstrap bootstrap
因为它没有帮助
谢谢!