1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

npm install実施時、npm ERR! code EJSONPARSEを始めとするエラーが発生

Posted at

npm install laravel-mix --save-devを実行時に下記のようなエラーが発生。

表示されたエラーメッセージ
npm ERR! code EJSONPARSE
npm ERR! path c:\xampp_new\xampp80\htdocs\laravel\manual/package.json
npm ERR! JSON.parse Unexpected token "/" (0x2F) in JSON at position 48 while parsing near "...scripts\": {\n        // \"dev\": \"vite\",\n  ..."
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\watan\AppData\Local\npm-cache\_logs\2022-07-08T12_10_14_519Z-debug-0.log

package.jsonファイルを編集した際のコメントアウトが残っていたのが原因だった模様。

package.json(エラー発生時)
   "scripts": {
        // 削除
        // "dev": "vite",
        // "build": "vite build"
    },
package.json(修正後)
    "scripts": {},

色々調べたところ、jsonファイルにわずかな違いがあるだけでエラーが出るらしいです。
要らない記述があった場合に、コメントアウトすれば万事解決するわけじゃないんですね。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?