doug-wade/tybalt

fastify scaffolding throws an error

Closed this issue · 1 comments

The docs say you can run npx @tybalt/cli scaffold fastify --name fastify-tybalt to create a new fastify project, but in real life, what happens is

» npx @tybalt/cli scaffold fastify --name fastify-tybalt
stdout:

Wrote to /Users/dougwade/temp/fastify-tybalt/package.json:

{
  "name": "fastify-tybalt",
  "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
    start: start the production server
    dev: start the development server


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

Error: Command failed: npm pkg set 'scripts.start'='fastify start -l info app.js'
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Invalid package.json: JSONParseError: Unexpected end of JSON input while parsing empty string
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: /Users/dougwade/.npm/_logs/2023-08-15T14_56_25_592Z-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 Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:514:28)
    at Pipe.<anonymous> (node:net:323:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: "npm pkg set 'scripts.start'='fastify start -l info app.js'",
  stdout: '',
  stderr: 'npm ERR! code EJSONPARSE\n' +
    'npm ERR! JSON.parse Invalid package.json: JSONParseError: Unexpected end of JSON input while parsing empty string\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: /Users/dougwade/.npm/_logs/2023-08-15T14_56_25_592Z-debug-0.log\n'
}

Node.js v18.17.1

duplicate of #370