Keystone JS (generator-keystone) npm install fails - keystonejs

I have installed Keystone with Yeoman Generator.
yo keystone command runs without errors, but the following npm install finishes with error:
npm ERR! Unexpected end of JSON input while parsing near '...6.4","react":"^16.8.6'
Data from debug log
2317 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...6.4","react":"^16.8.6'
2317 verbose stack at JSON.parse (<anonymous>)
2317 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2317 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
2317 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
How can I fix that?

Related

Npm install fails due to invalid version

So as part of some work I'm doing, I am trying to get the packages we use in our application up to the latest versions as when running npm audit there were a significant amount of vulnerabilities.
One of the the things it comes up saying to install mocha#9.2.2
I have been trying to do this but I get an error saying:
npm ERR! Invalid version: ^6.0.1
I have no idea what this is referring to as in the package.json there are no packages that have this version and when I look at the debug log I just get:
207 verbose stack TypeError: Invalid Version: ^6.0.1
207 verbose stack at new SemVer (C:\Program Files\nodejs\node_modules\npm\node_modules\semver\classes\semver.js:38:13)
207 verbose stack at compare (C:\Program Files\nodejs\node_modules\npm\node_modules\semver\functions\compare.js:3:32)
207 verbose stack at Object.gte (C:\Program Files\nodejs\node_modules\npm\node_modules\semver\functions\gte.js:2:30)
207 verbose stack at CanPlaceDep.checkCanPlaceCurrent (C:\Program Files\nodejs\node_modules\npm\node_modules\#npmcli\arborist\lib\can-place-dep.js:173:51)
207 verbose stack at CanPlaceDep.checkCanPlace (C:\Program Files\nodejs\node_modules\npm\node_modules\#npmcli\arborist\lib\can-place-dep.js:157:27)
207 verbose stack at new CanPlaceDep (C:\Program Files\nodejs\node_modules\npm\node_modules\#npmcli\arborist\lib\can-place-dep.js:114:26)
207 verbose stack at PlaceDep.place (C:\Program Files\nodejs\node_modules\npm\node_modules\#npmcli\arborist\lib\place-dep.js:121:19)
207 verbose stack at new PlaceDep (C:\Program Files\nodejs\node_modules\npm\node_modules\#npmcli\arborist\lib\place-dep.js:71:10)
207 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\#npmcli\arborist\lib\arborist\build-ideal-tree.js:949:31
207 verbose stack at Array.map (<anonymous>)
208 verbose cwd C:\tfs\Agility\Branches\AgilityMakeover\Client\Web\AgilityItemViewer
209 verbose Windows_NT 10.0.19044
210 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "mocha#9.2.2"
211 verbose node v16.14.0
212 verbose npm v8.3.1
213 error Invalid Version: ^6.0.1
214 verbose exit 1
So I have no idea what this could be referring to, as far as I can tell there is no package reference. I have tried just removing the package-lock.json file and the deleting the node_modules folder and running npm install again but I keep getting this error. But I have no clue on how to progress, any advice would be appreciated
What eventually seemed to solve the problem for me was going through the list of packages shown i.e semver, can-place-dep etc and updating them all manually by doing: npm update semver and so on. I then deleted my package-lock.json and node_modules folder again and did npm install. After this I stopped getting the invalid version error. Hopefully this can help someone else if they end up having the same issue I had
Try this
Delete npm_modules folder
Delete the package.json.lock file
run npm cache clean --force
And try npm install

How do I fix this issue in react native project - "npm ERR! Invalid tag name ">=^16.8.1"" this issue?

I am getting this error when install the node modules(npm install). Why this issue happening in react native project? Is this related to node version ?
Error :
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name ">=^16.8.1":
Tags may not have any characters that encodeURIComponent encodes. npm
ERR! A complete log of this run can be found in:
/Users/abcdef/.npm/_logs/2021-08-02T05_31_11_609Z-debug.log
Error Log (debug.log)
109 verbose stack Error: Invalid tag name ">=^16.8.1": Tags may not have any characters that encodeURIComponent encodes.
109 verbose stack at invalidTagName (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:89:15)
109 verbose stack at fromRegistry (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:343:13)
109 verbose stack at Function.resolve (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:80:12)
109 verbose stack at Arborist.[nodeFromEdge] (/usr/local/lib/node_modules/npm/node_modules/#npmcli/arborist/lib/arborist/build-ideal-tree.js:949:37)
109 verbose stack at async Arborist.[loadPeerSet] (/usr/local/lib/node_modules/npm/node_modules/#npmcli/arborist/lib/arborist/build-ideal-tree.js:1170:23)
109 verbose stack at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/#npmcli/arborist/lib/arborist/build-ideal-tree.js:886:11)
109 verbose stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/#npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
109 verbose stack at async Promise.all (index 1)
109 verbose stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/#npmcli/arborist/lib/arborist/reify.js:134:5)
109 verbose stack at async Install.install (/usr/local/lib/node_modules/npm/lib/install.js:150:5)
110 verbose cwd /Users/abcde/Project/XXX/Workspace/xyz-app
111 verbose Darwin 19.6.0
112 verbose argv "/usr/local/Cellar/node/16.4.2/bin/node" "/usr/local/bin/npm" "i"
113 verbose node v16.4.2
114 verbose npm v7.20.2
115 error code EINVALIDTAGNAME
116 error Invalid tag name ">=^16.8.1": Tags may not have any characters that encodeURIComponent encodes.
117 verbose exit 1
I got the solution for this issue. We can fix this issue in two ways,
Downgrade the npm version(In my case, I have downgraded it to 6.14.14 after that it's working fine.)
npm install -g npm#6.14.14
In the terminal, navigate to your project root directory and run this
npm install --legacy-peer-deps

Vue Create - Unexpected end of JSON input while parsing near '...2","standard-version"'

When I run vue create app1, I got this error in the error log:
2733 silly saveTree `-- #vue/cli-service#4.5.8
2734 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...2","standard-version"'
2734 verbose stack at JSON.parse (<anonymous>)
2734 verbose stack at parseJson (C:\Users\findi\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2734 verbose stack at C:\Users\findi\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
2734 verbose stack at runMicrotasks (<anonymous>)
2734 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
2735 verbose cwd C:\vue\app
2736 verbose Windows_NT 10.0.19041
2737 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\findi\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--loglevel" "error"
2738 verbose node v12.18.3
2739 verbose npm v6.14.8
2740 error Unexpected end of JSON input while parsing near '...2","standard-version"'
2741 verbose exit [ 1, true ]
Try running npm cache clean --force to clear out npm's cache

NPM outdated throws npm ERR! Not implemented yet

Since I updated to npm 6.9.0 (node 8.12.0) I'm getting this error when running npm outdated:
$ npm outdated
npm ERR! Not implemented yet
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jgallaso/.npm/_logs/2019-04-10T11_13_48_791Z-debug.log
The logs shows this error:
173 verbose stack Error: Not implemented yet
173 verbose stack at Object.packument (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/pacote/lib/fetchers/remote.js:12:22)
173 verbose stack at Object.Fetcher#packument [as packument] (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/genfun/lib/genfun.js:15:38)
173 verbose stack at packument (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/pacote/lib/fetch.js:17:18)
173 verbose stack at pinflight (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/pacote/packument.js:23:12)
173 verbose stack at /Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:29:24
173 verbose stack at Promise._execute (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/debuggability.js:313:9)
173 verbose stack at Promise._resolveFromExecutor (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:483:18)
173 verbose stack at new Promise (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:79:10)
173 verbose stack at _inflight (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:28:25)
173 verbose stack at /Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:22:14
173 verbose stack at tryCatcher (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
173 verbose stack at Promise._settlePromiseFromHandler (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
173 verbose stack at Promise._settlePromise (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
173 verbose stack at Promise._settlePromiseCtx (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:606:10)
173 verbose stack at _drainQueueStep (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:142:12)
173 verbose stack at _drainQueue (/Users/jgallaso/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
When I run npm outdated on a specific package, for instance eslint I get the proper output:
$ npm outdated eslint
Package Current Wanted Latest Location
eslint 5.15.1 5.16.0 5.16.0
What's happening here? Is it due to some buggy package or a bug NPM itself?
As a temporal solution you can install the latest npm:
npm i npm -g
npm i then npm update worked for me.

NPM fails when installing image-webpack-loader. I can't proceed with my project.

Webpack was working fine all day and when I added a new image it suddenly failed. I updated node and npm and I still get the following error. How would I go about fixing this or using an alternative? The other image loader modules I attempted to install give the same error.
74857 verbose stack Error: gifsicle#3.0.4 postinstall: `node lib/install.js`
74857 verbose stack Exit status 1
74857 verbose stack at EventEmitter.<anonymous> (C:\Users\mykod\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
74857 verbose stack at emitTwo (events.js:106:13)
74857 verbose stack at EventEmitter.emit (events.js:191:7)
74857 verbose stack at ChildProcess.<anonymous> (C:\Users\mykod\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
74857 verbose stack at emitTwo (events.js:106:13)
74857 verbose stack at ChildProcess.emit (events.js:191:7)
74857 verbose stack at maybeClose (internal/child_process.js:877:16)
74857 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
74858 verbose pkgid gifsicle#3.0.4
74859 verbose cwd C:\Users\mykod\Desktop\best-voted
74860 error Windows_NT 10.0.14393
74861 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mykod\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
74862 error node v6.9.4
74863 error npm v4.3.0
74864 error code ELIFECYCLE
74865 error errno 1
74866 error gifsicle#3.0.4 postinstall: `node lib/install.js`
74866 error Exit status 1
74867 error Failed at the gifsicle#3.0.4 postinstall script 'node lib/install.js'.
74867 error Make sure you have the latest version of node.js and npm installed.
74867 error If you do, this is most likely a problem with the gifsicle package,
74867 error not with npm itself.
74867 error Tell the author that this fails on your system:
74867 error node lib/install.js
74867 error You can get information on how to open an issue for this project with:
74867 error npm bugs gifsicle
74867 error Or if that isn't available, you can get their info via:
74867 error npm owner ls gifsicle
74867 error There is likely additional logging output above.
74868 verbose exit [ 1, true ]
Restarting doesn't help for me. There was problems with permissions on my laptop.
I'm working on Ubuntu 16.04.
Here is solution: fixing npm permissions
I'm recommending to watch video first.
At least check NPM's directory first npm config get prefix and if it's /usr, you have to use Option 2.
I've solved this problems with processing step by step of Option 2.
I restarted my computer and was able to install it. Windows.