Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid package.json: JSONParseError: Unexpected end of JSON input while parsing near #370

Open
doug-wade opened this issue Aug 4, 2023 · 1 comment
Labels
bug Something isn't working cli

Comments

@doug-wade
Copy link
Owner

» npx @tybalt/cli scaffold eleventy --name wombat
stdout:

Wrote to /home/doug/workspace/website/wombat/package.json:

{
  "name": "wombat",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}




installing dependencies; there may be errors
adding the following scripts to package.json
    test: run the unit tests
    build: build the static website
    serve: serve the local development website


node:internal/errors:865
  const err = new Error(message);
              ^

Error: Command failed: npm pkg set 'scripts.serve'='eleventy --serve'
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Invalid package.json: JSONParseError: Unexpected end of JSON input while parsing near "...ds\": [],\n  \"author\": "
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: /home/doug/.npm/_logs/2023-08-04T16_03_18_001Z-debug-0.log

    at ChildProcess.exithandler (node:child_process:419:12)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: "npm pkg set 'scripts.serve'='eleventy --serve'",
  stdout: '',
  stderr: 'npm ERR! code EJSONPARSE\n' +
    'npm ERR! JSON.parse Invalid package.json: JSONParseError: Unexpected end of JSON input while parsing near "...ds\\": [],\\n  \\"author\\": "\n' +
    'npm ERR! JSON.parse Failed to parse JSON data.\n' +
    'npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.\n' +
    '\n' +
    'npm ERR! A complete log of this run can be found in: /home/doug/.npm/_logs/2023-08-04T16_03_18_001Z-debug-0.log\n'
}

Node.js v18.17.0
@doug-wade doug-wade added bug Something isn't working cli labels Aug 4, 2023
@doug-wade doug-wade self-assigned this Aug 4, 2023
@doug-wade doug-wade added this to v0.1.0 Aug 4, 2023
@doug-wade doug-wade removed their assignment Aug 4, 2023
@doug-wade
Copy link
Owner Author

I'm wondering if we're racing with the creation of package.json? I also wonder if users run npm init first, if that would work around the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli
Projects
None yet
Development

No branches or pull requests

1 participant