xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

npm publish bug & solution

npm publish bug & solution

npm ERR! Unexpected token < in JSON at position 0 while parsing near '

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin/node',
1 verbose cli   '/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin/npm',
1 verbose cli   'adduser'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v12.18.0
4 verbose npm-session 32ba6f6d4eadad5e
5 verbose web login before first POST
6 http fetch POST 301 http://r.cnpmjs.org/-/v1/login 1638ms
7 verbose stack SyntaxError: Unexpected token < in JSON at position 0 while parsing near '<html>
7 verbose stack <head><title...'
7 verbose stack     at JSON.parse (<anonymous>)
7 verbose stack     at parseJson (/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
7 verbose stack     at /Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
7 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
7 verbose stack     at async Promise.all (index 1)
8 verbose cwd /Users/xgqfrms-mbp/Documents/GitHub/Node-CLI-Tools
9 verbose Darwin 19.6.0
10 verbose argv "/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin/node" "/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin/npm" "adduser"
11 verbose node v12.18.0
12 verbose npm  v6.14.4
13 error Unexpected token < in JSON at position 0 while parsing near '<html>
13 error <head><title...'
14 verbose exit [ 1, true ]


shit cnpm bug

nrm

$ nrm use npm

$ npm whoami

$ npm publish

OK ✅

refs

https://stackoverflow.com/questions/54656780/error-npm-err-unexpected-token-in-json-at-position-0-while-parsing-near

https://npm.community/t/error-unexpected-token-in-json-at-position/5671

npm publish

https://docs.npmjs.com/creating-and-publishing-scoped-public-packages/



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2021-01-02 23:20  xgqfrms  阅读(175)  评论(1编辑  收藏  举报