__ngcc_entry_points__.json requires root access when doing npm install · Issue #36990 · angular/angular · GitHub
Skip to content

__ngcc_entry_points__.json requires root access when doing npm install #36990

Closed

Description

@trandromeda

#36968 🐞 bug report

Affected Package

The issue is caused by package @angular/....

ngcc_entry_points.json

Is this a regression?

No

Description

Recently upgraded our apps (was 7.2.0, upgraded to 8 first, and then to the latest Angular 9.1.4). Noticing that __ngcc_entry_points.json is sometimes being added to node_modules, however it's always with root permission instead of the user:

-rw-r--r-- 1 root staff 14578 7 May 16:43 __ngcc_entry_points__.json

This causes npm i to throw EACCESS errors whenever it is run and this file exists. Could use sudo or chown but I do not think it should be created with the root user in the first place

🔬 Minimal Reproduction

  1. Delete node_modules folder
  2. Run npm i and re-install all packages
  3. All packages installed successfully - there is no ngcc_entry_points.json file in node_modules at this point, upon initial install
  4. Run npm i again and run into the EACCESS error as printed below.

Spinning up a new app with ng new repro-app does not create the __ngcc_entry_points.json file when running npm install.

This behaviour is not always consistent; the ngcc_entry_points file is not always created. I'm not sure what conditions lead to it.

🔥 Exception or Error




npm i
npm WARN checkPermissions Missing write access to /Users/andytran/dev/ng-zoom-app/node_modules/__ngcc_entry_points__.json
npm WARN grunt-contrib-clean@0.6.0 requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-socket-io@3.0.1 requires a peer of @angular/common@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-socket-io@3.0.1 requires a peer of @angular/core@^8.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /Users/andytran/dev/ng-zoom-app/node_modules/__ngcc_entry_points__.json
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/Users/andytran/dev/ng-zoom-app/node_modules/__ngcc_entry_points__.json'
npm ERR!  [Error: EACCES: permission denied, access '/Users/andytran/dev/ng-zoom-app/node_modules/__ngcc_entry_points__.json'] {
npm ERR!   stack: 'Error: EACCES: permission denied, access ' +
npm ERR!     "'/Users/andytran/dev/ng-zoom-app/node_modules/__ngcc_entry_points__.json'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/andytran/dev/ng-zoom-app/node_modules/__ngcc_entry_points__.json'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/andytran/.npm/_logs/2020-05-07T22_05_21_182Z-debug.log

🌍 Your Environment

Angular Version:


Angular CLI: 9.1.4
Node: 12.2.0
OS: darwin x64

Angular: 9.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, upgrade
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.901.4
@angular-devkit/build-angular      0.901.4
@angular-devkit/build-ng-packagr   0.901.4
@angular-devkit/build-optimizer    0.901.4
@angular-devkit/build-webpack      0.901.4
@angular-devkit/core               9.1.4
@angular-devkit/schematics         9.1.4
@ngtools/webpack                   9.1.4
@schematics/angular                9.1.4
@schematics/update                 0.901.4
ng-packagr                         9.1.3
rxjs                               6.5.5
typescript                         3.8.3
webpack                            4.42.0

Anything else relevant?
@angular/cli is also globally installed to the latest version, 9.1.4

Please let me know whatever else information is needed. This issue is baffling to me and I'm not sure how to debug it

Activity

  1. added this to the needsTriage milestone on May 7, 2020
  2. alxhub commented on May 7, 2020

    @alxhub
    Member

    The only way files can be created with the root user is if the process creating them is running as root.

    This can happen because:

    • the command to start the process was invoked as root
    • the binary for the process is owned by root and is installed "setuid".

    Both of these, I agree, are a terrible idea for ngcc. In ngcc's case the binary running it would be node, which would be an awful thing to have setuid. Unfortunately though this is something unique to your setup - there's nothing ngcc is doing that cares about or attempts to change about file ownership. So there's nothing here we can really help you with :(

  3. angular-automatic-lock-bot commented on Jun 7, 2020

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  4. locked and limited conversation to collaborators on Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions