這是我最初的代碼
{
"name": "react",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.6.1"
}
}
它扔錯誤
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN install Refusing to install react as a dependency of itself
然後我改名的名字從反應react_app和我的代碼看起來像
{
"name": "react_app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.6.1"
}
}
那麼它的工作
我最初命名的文件夾具有相同的名稱,我想安裝的模塊。我忽略了'npm init'指令。儘管更改了目錄名稱,但我仍然遇到了錯誤。謝謝@shennan,現在我已經改變了'package.json'中的名字,這個世界是和平的:) – DDM 2016-01-26 12:30:54
同樣的事情,包的名字和模塊是一樣的。 – Antoine 2016-03-13 22:37:36