Skip to content

SyntaxError: /usr/local/lib/node_modules/npm/package.json: Unexpected token '', ""... is not valid JSON #20

@Stitch-Taotao

Description

@Stitch-Taotao

Cannot success following docker desktop Learning Center 's instruction

  1. My docker is installed with wsl2 backend
  2. Container type is linus container
  3. Cmd run in Idea's terminal , also wrong when run in powershell.
docker compose up -d :Logs
 docker compose up -d
[+] Building 0.0s (0/0)  docker:default
[+] Building 3.1s (9/12)                                                                                                                                                                                             docker:default
 => [todo-app internal] load build definition from Dockerfile                                                                                                                                                                  0.0s
 => => transferring dockerfile: 1.29kB                                                                                                                                                                                         0.0s 
 => [todo-app] resolve image config for docker.io/docker/dockerfile:1                                                                                                                                                          1.6s 
 => CACHED [todo-app] docker-image://docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021                                                                                     0.0s
 => [todo-app internal] load metadata for docker.io/library/node:19.5.0-alpine                                                                                                                                                 0.9s 
 => [todo-app internal] load .dockerignore                                                                                                                                                                                     0.0s
 => => transferring context: 706B                                                                                                                                                                                              0.0s 
 => [todo-app stage-0 1/6] FROM docker.io/library/node:19.5.0-alpine@sha256:4619ec6c9a43ab4edfa12cf96745319c3ca43aff9dd630ab20e684dd3632318e                                                                                   0.0s 
 => [todo-app internal] load build context                                                                                                                                                                                     0.0s 
 => => transferring context: 904B                                                                                                                                                                                              0.0s 
 => CACHED [todo-app stage-0 2/6] WORKDIR /usr/src/app                                                                                                                                                                         0.0s 
 => ERROR [todo-app stage-0 3/6] RUN --mount=type=bind,source=package.json,target=package.json     --mount=type=bind,source=package-lock.json,target=package-lock.json     --mount=type=cache,target=/root/.npm     npm ci --  0.3s
------
 > [todo-app stage-0 3/6] RUN --mount=type=bind,source=package.json,target=package.json     --mount=type=bind,source=package-lock.json,target=package-lock.json     --mount=type=cache,target=/root/.npm     npm ci --include=dev:  
0.312 undefined:1
0.312
0.312
0.312
0.312 SyntaxError: /usr/local/lib/node_modules/npm/package.json: Unexpected token '', ""... is not valid JSON
0.312     at parse (<anonymous>)
0.312     at Module._extensions..json (node:internal/modules/cjs/loader:1315:39)
0.312     at Module.load (node:internal/modules/cjs/loader:1103:32)
0.312     at Module._load (node:internal/modules/cjs/loader:942:12)
0.312     at Module.require (node:internal/modules/cjs/loader:1127:19)
0.312     at require (node:internal/modules/helpers:112:18)
0.312     at createEnginesValidation (/usr/local/lib/node_modules/npm/lib/cli.js:7:15)
0.312     at module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:78:27)
0.312     at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:25)
0.312     at Module._compile (node:internal/modules/cjs/loader:1246:14)
0.312
0.312 Node.js v19.5.0
------
failed to solve: process "/bin/sh -c npm ci --include=dev" did not complete successfully: exit code: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions