Npm error when start ionic v4 template

Hi I wanted to start a fresh ionic app, but I’m just getting this error (ionic is installed):

> npm i
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! Unexpected end of JSON input while parsing near '...:{"strip-ansi":"^4.0.'

[ERROR] An error occurred while running subprocess npm.

        npm i exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: running 1 functions +2ms
  ionic:cli-framework:utils:process error while killing process tree for 7392: { Error: Command failed: taskkill /pid 7392 /T /F
  ionic:cli-framework:utils:process FEHLER: Der Prozess "7392" wurde nicht gefunden.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:275:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:925:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 7392 /T /F' } +203ms
  ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 7392 /T /F
  ionic:cli-framework:utils:process FEHLER: Der Prozess "7392" wurde nicht gefunden.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:275:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:925:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 7392 /T /F' } +12ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +2ms

Does anybody can help me here?

Looks like a connection problem.

Have you tried turning it off and on again?

Turning what off and on again?

Remove the node_modules folder and run npm install again

I don’t have any node_modules folder, it created just “src” and “e2e” as folders.

Just run npm install in the root of the project then

Unfortunately this leads to the same error:

npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! Unexpected end of JSON input while parsing near '...:{"strip-ansi":"^4.0.'

Close and reopen the console window, logout and login your user, restart your computer.
If this still doesn’t work, reinstall Node and make sure it is properly installed.

I tried all of your suggestions, but none of them worked (reboot, node reinstall, …).

Have you tried running the command prompt with admin rights?

there is no difference ;-(

Can you run the command again with the --verbose flag and post the entire log?
That might hold some extra information to find the cause.

The first post contains the --verbose output. I don’t get more information on that.

Your problem is probably with npm, something to do with permissions and files. This happens quite often and is almost impossible to successfully debug (at least here in the forum).

One solution: Uninstall your node, install nvm (or nvm-windows if you are on Windows), install a new node (which includes npm) with this, then install ionic and cordova again and try your command again. The problem should be gone.

It really was a problem with npm.
I found the solution here: