Error Occurs while installing via CLI

currently getting This error while starting a new project using CMD in windows 7

npm ERR! Unexpected end of JSON input while parsing near '…ies":{“eslint”:"^5.0.'

and the Install process unexpectedly terminates.

This causes fails while uninstalling packages inside the project module.

Example Converting from Ts to Js : Uninstalling all the Typescript related packages fails with
"Unexpected end of JSON input while parsing near {…Some File Name…}

Current behaviour:

  1. Install Process terminates with a Debug log.
  2. when you try to start the project with Ionic serve you are asked to install @vue/cli-service
  3. if selected ‘Yes’ Error is thrown “npm ERR! Unexpected end of JSON input while parsing near '…0-alpha.14”:{“name”:’"
  4. New Debug Log is created.

Expected behavior:
Ionic Start should complete the setup and ask for creating a account

This is a screenShot of the error i am getting in the CMD prompt… Any Pointers as to what is going wrong here

Tried to install a Fresh Copy of @ionic/CLI 6.13 on an X64 arch laptop… totally different machine hardware, not a VM, and yet I run into this same issue.
this new machine is an i5 core 5th gen with 16 GB ram…

Please help @aaronksaunders or @dlodeprojuicer @mhartington

Here are a few First lines and some last lines from the debug log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli ‘C:\Program Files\nodejs\node.exe’,
1 verbose cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘i’
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.15.1
4 verbose npm-session 8411158d10cd41c8
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall first-app@0.0.1
7 info lifecycle first-app@0.0.1~preinstall: first-app@0.0.1
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 217ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 109ms
16 silly install loadAllDepsIntoIdealTree
17 http fetch GET 304 339ms (from cache)

4137 silly pacote range manifest for @babel/traverse@^7.1.0 fetched in 42ms
4138 http fetch GET 200 81ms
4139 http fetch GET 200 99ms
4140 http fetch GET 200 42ms
4141 http fetch GET 200 142ms
4142 http fetch GET 200 65ms
4143 silly pacote range manifest for is-generator-fn@^2.0.0 fetched in 151ms
4144 silly pacote range manifest for co@^4.6.0 fetched in 154ms
4145 http fetch GET 200 31ms
4146 silly pacote range manifest for jest-each@^24.9.0 fetched in 180ms
4147 timing npm Completed in 385545ms
4148 error cb() never called!
4149 error This is an error with npm itself. Please report this error at:
4150 error

I GIVE UP… Good luck getting help if you land on this thread… no help can found either on forums or Github issue or Company support…

Forums- you get no reply or you get PMs from mod to remove them from the @mentions… apparently, @mentioning mods who are answering similar questions find it RUDE… getting mentioned…

Github Issues- Gets closed saying it not a bug and you get pointed to the Forums with the Issue getting close…

Company Support - well as you might expect no paid account no support for you neither a tiny Winnie troubleshooting… not worth their time…

Why hello there! Just seeing this as I’ve been away for a bit.

Just testing this on my machine and haven’t been able to replicate it at all.

I’d validate that you have both node lts and at least npm 6 installed.

Based on the output from the log file, the issue doesn’t appear to be related to Ionic’s cli at all

4146 silly pacote range manifest for jest-each@^24.9.0 fetched in 180ms
4147 timing npm Completed in 385545ms
4148 error cb() never called!
4149 error This is an error with npm itself. Please report this error at:
4150 error

This would seem either npm or a package from jest are to blame. You can verify this by running your start command again with --no-deps and try to npm install after.

hi @mhartington so did i as you said
i tested this on the second machine that i had mentioned in my ealier post.
here are the details
npm version 6.14.8
node version 14.15.1
i navigated to the folder where i want to start the project and ran
ionic start --no-deps
template-blank the command successed

after this when i went inside the create app and ran npm install it failed

npm WARN deprecated urix@0.1.0: Please see
npm WARN deprecated resolve-url@0.2.1:
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! cb() never called!

i have a been reading around this ERR cb() never called on npm community and so far what most of user seems to be saying is that its the Dependency tree begin too large. and sometime due to having older version of NPM itself…

My concern is that untill 7 days back ionic start and npm was okay with what i have and i was able to create as many project i wanted… what changed 7 days back, which broke everything…

typically if something changed, it’s due to changes in dependencies of other dependencies, so it’s hard to track down what exactly could have changed.

Looking through this issue

It seems to have been address (though the post is rather old). If you’re on your windows machine, start an admin prompt and install a newer version of npm with

npm i -g npm@latest

Finally ionic start is now running as expected on the second machine but i am yet to make it a success on my original dev machine which is win 7 OS,

  1. I First ran npm cache clear -force no Change in output

  2. Then I updated the npm version from 6.14.8 to 7.11.1

Here ionic start was successful but then while in output I got a version mismatch for Vue-loader not sure why this happened [screenshot attached]

  1. completely reinstalled Nodejs and Npm as npm list -g --depth=0 listed only these 3 packages
    a. vue/cli and
    b. ionic/cli

reinstalled Ionic/cli first then vue/cli and it started working.

This has succeeded on the test machine thus, I will now try to upgrade the npm on the original machine where I do have a few live projects and post it that fails or succeed
[removed vue from the list as i assumed Vue/cli installed it as a part of it but it was not]

So to test all was good i download a git repo that i made some 20 days back
here is how it went…
After i open the code in vscode

  1. I did npm install it was completed with over 13 vulnerabilities.
  2. So i did npm audit & then npm audit fix --force to my surprise the report came back with 32 more vulnerabilities.
  3. repeated the npm audit fix --force report came back with 14 more vulnerabilities.
  4. then i simply skipped audit and did ionic serve that started the application but gave me Vue package version mismatch refer to the screenshot below.
  5. then i realised the vue3 was not installed globally only vue/cli 4x was.
  6. so installed vue npm install vue@next
  7. deleted node_modules from the project and did npm install
  8. again it showed 14 vulnerabilities, skipping the audit i decided to just do Ionic serve

And now i get

> vue-cli-service.cmd serve
[vue-cli-service]  INFO  Starting development server...
[vue-cli-service] Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined
[vue-cli-service] You may use special comments to disable some warnings.
[vue-cli-service] Use // eslint-disable-next-line to ignore the next line.
[vue-cli-service] Use /* eslint-disable */ to ignore all warnings in a file.

[INFO] Development server running!

       Local: http://localhost:8100

       Use Ctrl+C to quit this process

[INFO] Browser window opened to http://localhost:8100!

[vue-cli-service] F:\Jumbotronic\take-1\node_modules\watchpack\lib\chokidar.js:17
[vue-cli-service] throw new Error(
[vue-cli-service] ^
[vue-cli-service] Error: No version of chokidar is available. Tried chokidar@2 and chokidar@3.
[vue-cli-service] You could try to manually install any chokidar version.
[vue-cli-service] chokidar@3: Error: Cannot find module 'chokidar'
[vue-cli-service] Require stack:
[vue-cli-service]     at Module.require (internal/modules/cjs/loader.js:952:19)
[vue-cli-service]     at require (internal/modules/cjs/helpers.js:88:18)
[vue-cli-service]     at WatcherManager.getDirectoryWatcher (F:\Jumbotronic\take-1\node_modules\watchpack\lib\watcherManager.js:14:25)
[vue-cli-service]     at WatcherManager.watchFile (F:\Jumbotronic\take-1\node_modules\watchpack\lib\watcherManager.js:28:14)

[ERROR] vue-cli-service has unexpectedly closed (exit code 1).

        The Ionic CLI will exit. Please check any output above for error details.

I will share the Git repo if required for now… all the command line output is documented in the link shared below
ScreenShot for the Step 4

Step 1 to 5 PasteBin Link
Step 6 onward PasteBin Link

Ok, so let’s start with this and get things working before you go and change dependencies…

This is the base starters for Ionic vue projects, just delete your node modules, any package lock file, and add the deps and devdeps in this file to your project.

Once that is done, npm install and try to serve. Again, we should just get things to work before anything else.

I copied the deps and devdeps and only excluded the package related to typescript as the repo i am testing is in js [figured i should have mentioned this in my earlier comment]. Nonetheless npm install was a succeded with 32 vulnerabilities and on serve the project gave the desired output.

doing npm audit fix --force broke it again with the same Error "Vuepackage version mismatch

thus i repeated the process of up untill npm install and the project is working again

Cmd Log before audit fix Link
cmd Log After audit fix Link

I am yet to add "@capacitor/core": "2.4.7", & "@capacitor/cli": "2.4.7", to the project as these are the only two extra packages i had originally in the repo apart from the package from starter

Well stop with the audit fix --force :grinning_face_with_smiling_eyes:

But seriously, the --force flag is obviously causing issues as it doesn’t care about package versioning and just grabs what ever is listed under “latest” from npm. So the fact you are getting version mismatch warnings is to be expected at this point.

Most of the audit output is warnings, not actual errors, so it’s safe to ignore for now.

:smile: Okay will stop the audit --fix… btw also added capacitor & capacitor/cli packages all is good with the repo was able to successfully run npx cap add android and npx cap open android

So far what I think is happening is one of the edge cases where I am trying to run a code that has older deps on the latest machine which has some of the deps package installed globally on the machine but with a higher version…

Npm is a fickle creature…

But glad to hear you’re all sorted out now. I’ll take a look at our starters and try to resolve any audit issues that could be in there so this sort of thing does not happen in the future!

1 Like

Leaving a note for folks who may find this…

After running npm audit fix --force, I followed up with

$ npm i @vue/cli-service@latest

And things were working again.

1 Like

turn out it was the npm 7 new updates that caused all those dep issue…
Link to Npm 7 update

more specifically this statement in there

In previous versions of npm (4-6), peer dependencies conflicts presented a warning that versions were not compatible, but would still install dependencies without an error. npm 7 will block installations if an upstream dependency conflict is present that cannot be automatically resolved.

1 Like