Estou seguindo um tutorial sobre reagir e a etapa final é iniciar o nó, mas quando faço "npm start", conforme indicado por este tutorial. Eu recebo esse erro.
aqui está o erro cmd linha está me dando no nó inicial "npm start"
C:UsersGeorgeDesktopreactapp>npm start
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\nodejs\node.exe" "C:\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! file C:UsersGeorgeDesktopreactapppackage.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token """ at 11:3
npm ERR! "keywords": [
npm ERR! ^
npm ERR! File: C:UsersGeorgeDesktopreactapppackage.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! C:UsersGeorgeDesktopreactappnpm-debug.log
e finalmente aqui está o meu arquivo package.json
{
"name": "reactapp",
"version": "1.0.0",
"description": "test react application",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node server.js"
}
}
"keywords": [
"test",
"react",
"application"
],
"author": "George Louis",
"license": "ISC",
"dependencies": {
"webpack": "^3.0.0"
}
}
Respostas:
0 para resposta № 1Está faltando vírgula entre }
e "keywoards"
, Você também tem o suficiente }
.
Seu JSON deve parecer
{
"name": "reactapp",
"version": "1.0.0",
"description": "test react application",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node server.js"
},
"keywords": [
"test",
"react",
"application"
],
"author": "George Louis",
"license": "ISC",
"dependencies": {
"webpack": "^3.0.0"
}
}
0 para resposta № 2
Se você ler o rastreio, o npm está dizendo a resposta
npm ERR! Unexpected token """ at 11:3
npm ERR! "keywords": [
npm ERR! ^
npm ERR! File: C:UsersGeorgeDesktopreactapppackage.json
Indica o que está "errado (a vírgula), em qual linha (11) e em qual linha (3) de qual arquivo (C:UsersGeorgeDesktopreactapppackage.json
).
Então, está faltando uma vírgula:
"start": "node server.js"
}
},
"keywords": [
"test",
"react",
"application"
],
Observe a vírgula antes de "palavras-chave", que está ausente no seu JSON, portanto, é inválida.