Help us understand the problem. What is going on with this article?

【package.json】「An unexpected error occurred~」エラーが出た時の対処法

参考

最短で学ぶReactとReduxの基礎から実践まで/Udemy

事象

  • 静的解析ツール(eslint)の導入
  • yarn add eslint@3.19.0 eslint-plugin-react@7.1.0を実行
  • 下記のエラーメッセージが発生

error An unexpected error occurred: "C:\./udemy_react\package.json: Unexpected string in JSON at position 220".

原因

package.jsonファイルに
scripsを追記したとき(カンマ)をつけ忘れてた

package.json
  "scripts": {
    "start": "./node_modules/.bin/webpack-dev-server"
   } //← ここ!!
  "dependencies": {

全体のソースコード

package.json
{
  "name": "udemy_react",
  "version": "1.0.0",
  "main": "index.js",  "author": "Yokota Nanshin <nan0829068@gmail.com>",
  "license": "MIT",
  "scripts": {
    "start": "./node_modules/.bin/webpack-dev-server"
   },
  "dependencies": {
    "babel-core": "6.25.0",
    "babel-loader": "7.1.1",
    "babel-preset-es2015": "6.24.1",
    "babel-preset-react": "6.24.1",
    "babel-preset-react-es2015": "^1.3.0",
    "webpack": "3.3.0",
    "webpack-dev-server": "2.5.1"
  }
}
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away