【发布时间】:2020-02-20 17:03:44
【问题描述】:
我运行了 npm install,得到了节点模块和包,但是当我运行 npm start 时,我得到了这个错误:
./src/contentful.js
未找到模块:无法解析“C:\Users\Dannis\my-blog\src”中的“内容”
我尝试删除package-json.lock,然后运行npm install 和npm start,但仍然得到相同的块。 (也试过npm update、npm install和npm start,还是一样的bug)。
这就是我的 package.json 的样子:
{
"name": "my-blog",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.2.1",
"contentful": "^7.13.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.4.0",
"touch": "^3.1.0"
},
"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"
]
}
}
我尝试安装 react-router-dom、react-markdown 和 history,但出现此错误:
无法读取未定义的属性“匹配”。
有什么想法吗?
【问题讨论】:
-
你有什么版本的 NodeJS/NPM?
-
你能发布你正在导入
./src/contentful.js的代码吗?
标签: reactjs npm dependencies