Suddenly unable to start new Project

Everything is working fine but suddenly unable to start new project with error.

> npm i
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Unexpected end of JSON input while parsing near '...XuvJHwJRfyznxU\nqPi4D'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/.../.npm/_logs/2020-03-26T13_55_17_902Z-debug.log
[ERROR] An error occurred while running subprocess npm.

Command: ionic start myApp

Ionic:

Ionic CLI : 6.3.0

Utility:

cordova-res (update available: 0.11.0) : 0.9.0
native-run : 0.3.0

System:

NodeJS : v12.16.1
npm : 6.14.4
OS : macOS Catalina

npm 6.14.4
node v12.16.1

Hmm, I’d say look at what npm ERR! /Users/.../.npm/_logs/2020-03-26T13_55_17_902Z-debug.log error log is printing?

not a lot of to go off of from that, so not sure really!

3424 silly saveTree └── zone.js@0.9.1
3425 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...PEoRwOKujGhqr8zgLGlNc'
3425 verbose stack     at JSON.parse (<anonymous>)
3425 verbose stack     at parseJson (/Users/../.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
3425 verbose stack     at /Users/../.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
3425 verbose stack     at runMicrotasks (<anonymous>)
3425 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
3426 verbose cwd /Users/../Desktop/Coding/v2/account
3427 verbose Darwin 19.3.0
3428 verbose argv "/Users/../.nvm/versions/node/v12.16.1/bin/node" "/Users/../.nvm/versions/node/v12.16.1/bin/npm" "i"
3429 verbose node v12.16.1
3430 verbose npm  v6.14.4
3431 error Unexpected end of JSON input while parsing near '...PEoRwOKujGhqr8zgLGlNc'
3432 verbose exit [ 1, true ]

I tired run npm cache clean --force and received error above

Still not a lot to go off of from that…
:thinking:

Could you try

$ ionic start tmp-ng blank --type angular --verbose

Let me check with the team and get their thoughts.

Same, received this error.
The full log is too long to post here.

2473 silly pacote range manifest for ts-node@~7.0.0 fetched in 23ms
2474 silly resolveWithNewModule ts-node@7.0.1 checking installable status
2475 silly pacote range manifest for tslint@~5.15.0 fetched in 19ms
2476 silly resolveWithNewModule tslint@5.15.0 checking installable status
2477 silly pacote range manifest for typescript@~3.4.3 fetched in 20ms
2478 silly resolveWithNewModule typescript@3.4.5 checking installable status
2479 http fetch GET 304 https://registry.npmjs.org/@angular%2fcompiler 132ms (from cache)
2480 silly fetchPackageMetaData error for @angular/compiler@~8.2.14 Unexpected end of JSON input while parsing near '...PEoRwOKujGhqr8zgLGlNc'
2481 timing stage:rollbackFailedOptional Completed in 3ms
2482 timing stage:runTopLevelLifecycles Completed in 26364ms
2483 silly saveTree tmp-ng@0.0.1
2483 silly saveTree β”œβ”€β”€ @angular-devkit/build-angular@0.803.25
2483 silly saveTree β”œβ”€β”€ @angular/cli@8.3.25
2483 silly saveTree β”œβ”€β”¬ @angular/common@8.2.14
2483 silly saveTree β”‚ └── tslib@1.11.1
2483 silly saveTree β”œβ”€β”€ @angular/compiler-cli@8.2.14
2483 silly saveTree β”œβ”€β”€ @angular/core@8.2.14
2483 silly saveTree β”œβ”€β”€ @angular/forms@8.2.14
2483 silly saveTree β”œβ”€β”€ @angular/language-service@8.2.14
2483 silly saveTree β”œβ”€β”€ @angular/platform-browser-dynamic@8.2.14
2483 silly saveTree β”œβ”€β”€ @angular/platform-browser@8.2.14
2483 silly saveTree β”œβ”€β”€ @angular/router@8.2.14
2483 silly saveTree β”œβ”€β”¬ @ionic-native/core@5.23.0
2483 silly saveTree β”‚ └── @types/cordova@0.0.34
2483 silly saveTree β”œβ”€β”€ @ionic-native/splash-screen@5.23.0
2483 silly saveTree β”œβ”€β”€ @ionic-native/status-bar@5.23.0
2483 silly saveTree β”œβ”€β”€ @ionic/angular-toolkit@2.2.0
2483 silly saveTree β”œβ”€β”¬ @ionic/angular@5.0.6
2483 silly saveTree β”‚ └─┬ @ionic/core@5.0.6
2483 silly saveTree β”‚   └── ionicons@5.0.1
2483 silly saveTree β”œβ”€β”€ @types/jasmine@3.3.16
2483 silly saveTree β”œβ”€β”€ @types/jasminewd2@2.0.8
2483 silly saveTree β”œβ”€β”€ @types/node@8.9.5
2483 silly saveTree β”œβ”€β”€ codelyzer@5.2.1
2483 silly saveTree β”œβ”€β”€ core-js@2.6.11
2483 silly saveTree β”œβ”€β”€ jasmine-core@3.4.0
2483 silly saveTree β”œβ”€β”€ jasmine-spec-reporter@4.2.1
2483 silly saveTree β”œβ”€β”€ karma-chrome-launcher@2.2.0
2483 silly saveTree β”œβ”€β”€ karma-coverage-istanbul-reporter@2.0.6
2483 silly saveTree β”œβ”€β”€ karma-jasmine-html-reporter@1.5.3
2483 silly saveTree β”œβ”€β”€ karma-jasmine@2.0.1
2483 silly saveTree β”œβ”€β”€ karma@4.1.0
2483 silly saveTree β”œβ”€β”€ protractor@5.4.3
2483 silly saveTree β”œβ”€β”€ rxjs@6.5.4
2483 silly saveTree β”œβ”€β”€ ts-node@7.0.1
2483 silly saveTree β”œβ”€β”€ tslib@1.11.1
2483 silly saveTree β”œβ”€β”€ tslint@5.15.0
2483 silly saveTree β”œβ”€β”€ typescript@3.4.5
2483 silly saveTree └── zone.js@0.9.1
2484 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...PEoRwOKujGhqr8zgLGlNc'
2484 verbose stack     at JSON.parse (<anonymous>)
2484 verbose stack     at parseJson (/Users/../.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
2484 verbose stack     at /Users/../.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
2484 verbose stack     at runMicrotasks (<anonymous>)
2484 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
2485 verbose cwd /Users/../Desktop/Coding/v2/tmp-ng
2486 verbose Darwin 19.3.0
2487 verbose argv "/Users/../.nvm/versions/node/v12.16.1/bin/node" "/Users/../.nvm/versions/node/v12.16.1/bin/npm" "i"
2488 verbose node v12.16.1
2489 verbose npm  v6.14.4
2490 error Unexpected end of JSON input while parsing near '...PEoRwOKujGhqr8zgLGlNc'
2491 verbose exit [ 1, true ]

That looks like a corrupt download for this particular package. I would look into potentially changing npm registries at least temporarily using npm config.

error Unexpected end of JSON input while parsing near…

verify you have a healthy network connection i recommend you to use vpn
shut down studio
delete the <user home>/.ionic/Studio/Tools/ directory
restart Studio and wait for output in the Tool Check background task

I even try download with different ISP but doesn’t solve the problem.
Mind sharing how to do with npm config?

checked, I didn’t installed ionic studio.
Tried VPN to several countries, same error.

Thanks @mhartington @rapropos @itosoft for your kindly help.

I just find out it is caused by the Mac os firewall.
I had enable the firewall few weeks ago and never start new project after that.

I can build new project without any issue after firewall disabled.

Thanks and stay healthy there.

1 Like