Open andreken opened 2 years ago
Similar error here.
np - 8.0.4 Node.js - 16.20.0 npm - 9.0.0 OS - ubuntu 20.04
This is still an issue with np@9.2.0
/ Node.js v20.10.0
- can't do a pre-release:
? Select SemVer increment or specify new version prerelease 0.0.1-0
✖ SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Module.prereleaseTags (file:///F:/DEV/open-source/contributing/posthtml-i18n/node_modules/np/source/npm/util.js:92:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.choices (file:///F:/DEV/open-source/contributing/posthtml-i18n/node_modules/np/source/ui.js:312:36)
Cosmin@work MINGW64 /f/DEV/open-source/contributing/posthtml-i18n (master)
$ npm list np
posthtml-i18n@0.0.0 F:\DEV\open-source\contributing\posthtml-i18n
└── np@9.2.0
Cosmin@work MINGW64 /f/DEV/open-source/contributing/posthtml-i18n (master)
$ node -v
v20.10.0
Had to publish a patch release instead (0.0.1
), which worked fine.
If your using npm 10, then you need this patch which seems to be included only in np@v10.0.5
for now
Attempting release of prerelease 0.0.1-alpha.1
.
✖ SyntaxError: Unexpected token 'p', "npm error c"... is not valid JSON
at JSON.parse (<anonymous>)
at Module.prereleaseTags (file:///Users/[...]/node_modules/.pnpm/np@10.0.7_typescript@5.5.3/node_modules/np/source/npm/util.js:100:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.choices (file:///Users/[...]/node_modules/.pnpm/np@10.0.7_typescript@5.5.3/node_modules/np/source/ui.js:300:36)
node@20.15.1
npm@10.7.0
np@10.0.7
git@2.39.3
macOS@14.5
Description
When I execute the command
np
and chooseprerelease
I receive the following error message:Unexpected token u in JSON at position 0
This happens when I have already created a prerelease and I'm trying to update it. The first time I published the prerelease (v5.0.0-0
) it worked as expected.package.json
``` { "version": "5.0.0-0", "engines": { "node": ">=14 <15", "npm": ">=6 <7" }, ... "files": [ "lib", "dist" ], "scripts": { "start": "rimraf .tmp/* && BABEL_ENV=development webpack-dev-server --config webpack.dev.config.js", "eslint": "eslint src/ --ext .js --ext .jsx", "eslint:fix": "eslint src/ --ext .js --ext .jsx --fix", "build:lib": "rimraf lib/* && BABEL_ENV=production babel src --out-dir lib", "build:dist": "rimraf dist/* && BABEL_ENV=production webpack --config webpack.prod.config.js", "prebuild": "npm run eslint", "build": "npm run build:lib && npm run build:dist", "deploy": "npm run build && np", "test": "" }, "peerDependencies": { ... }, "dependencies": { ... }, "devDependencies": { ... } } ```Steps to reproduce
npm run deploy -- --any-branch
prerelease
(in my case5.0.0-1
)Unexpected token u in JSON at position 0
Expected behavior
A new prerelease is created, with tag
v5.0.0-1
Temporary workaround
Run
npx np prerelease --any-branch --tag=beta
Environment
np - 7.6.0 Node.js - 14.18.1 npm - 6.14.15 Git - 2.30.1 OS - macOS 11.5.1