Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic invalid package name __ngcc_entry_points__.json

I'm almost finished developing my application with ionic and angular. Unfortunately, I'm totally stuck. I can't build my application (on android) anymore.

Here's the error:

ionic cordova build android
cordova.cmd platform add android --save
Using cordova-fetch for cordova-android@^8.0.0
Failed to fetch platform cordova-android@^8.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "__ngcc_entry_points__.json": name cannot start with an underscore

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Jules\AppData\Roaming\npm-cache\_logs\2020-06-09T17_09_27_363Z-debug.log
[ERROR] An error occurred while running subprocess cordova.

This problem had already happened to me on another project. To fix it I just had to search in the file explorer and rename __ngcc_entry_points__.json without the underscore of the beginning. Even if some time later it would come back, I just had to rename it to.

Unfortunately, __ngcc_entry_points__.json is totally untraceable everywhere in my project. I'm completely blocked.

like image 889
VeeN Avatar asked Jun 09 '20 17:06

VeeN


3 Answers

Solution to this problem is:

rm -rf node_modules

npm install 
like image 83
Jonathan Duarte Avatar answered Oct 06 '22 21:10

Jonathan Duarte


I have often experienced seeing this error message while working on Angular projects. And that prevents adding any dependencies due to the conflicts in the package-lock.json file. Whereas removing the node modules folder and reinstalling them gets rid of this, it's not always feasible to do that as for bigger projects, it can consume a lot of time. The solution that works for me is

  1. Deleting package-lock.json file
  2. Deleting ngcc_entry_points.json file from the node_modules folder
  3. Running npm install (It just recreates the package-lock.json file) And just like that conflicts get resolved! Hope it helps save time for someone.
like image 15
Arindam Dawn Avatar answered Oct 06 '22 20:10

Arindam Dawn


I had this problem and it was caused due to __ngcc_entry_points__ element in package-lock.json file (can be located in the root directory, next to package.json).

Removing the __ngcc_entry_points__ element from package-lock.json, deleting node_modules and running npm install again fixed the problem

like image 10
Aharon Ohayon Avatar answered Oct 06 '22 22:10

Aharon Ohayon