Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@YNanshin

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

More than 1 year has passed since last update.

参考

最短で学ぶ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"
  }
}
0
Help us understand the problem. What is going on with this article?
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
YNanshin
2019年4月からフリーランスのエンジニアとして活動しています WordPress/PHP/Python/MySQL/Datadog/Kibana/Elasticsearch/Github

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?