Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNPM recursive breaks ng build #16219

Closed
1 of 15 tasks
fehrm opened this issue Nov 19, 2019 · 1 comment · Fixed by #16235
Closed
1 of 15 tasks

PNPM recursive breaks ng build #16219

fehrm opened this issue Nov 19, 2019 · 1 comment · Fixed by #16235
Labels
Milestone

Comments

@fehrm
Copy link

fehrm commented Nov 19, 2019

Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Description

The issue is that ng build fails with error:

An error occurred during the build: Error: Cannot find module '@angular/core/package.json'
if the repo is standard .NET Core Angular project with recursive pnpm workspace. So I have

📁 topfolder
└── node_modules
    └── .pnpm
        └── registry.npmjs.org
            └── @angular etc

and actual Angular directory:

📁 topfolder
└── ASP.Net Core folder
    └── ClientApp
        └── node_modules (symlink to topfolder)

I can make ng build work with pnpm if I don't use recursive or workspace.

🔬 Minimal Reproduction

I made a sample project for this problem, https://github.com/fehrm/angular_pnpm_sample
The steps I took to make it is

  • dotnet new angular
  • add pnpm-workspace.yaml with new folder
  • Update dependencies to latest
  • pnpm recursive install
  • cd angpnpm\ClientApp
  • ng build

🔥 Exception or Error


[error] Error: Cannot find module '@angular/core/package.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.resolve (internal/modules/cjs/helpers.js:30:19)
    at compiler.hooks.contextModuleFactory.tap.cmf (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\@ngtools\webpack\8.3.19_177969776f9abbb18f72b9c4c5822988\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:561:56)
    at SyncHook.eval [as call] (eval at create (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapable\lib\HookCodeFactory.js:19:10), :9:1)
    at SyncHook.lazyCompileHook (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.createContextModuleFactory (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:637:35)
    at Compiler.newCompilationParams (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:644:31)
    at Compiler.compile (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:651:23)
    at readRecords.err (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:321:11)
    at Compiler.readRecords (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:519:11)
    at hooks.run.callAsync.err (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:318:10)
    at _err0 (eval at create (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapable\lib\HookCodeFactory.js:33:10), :11:1)
    at compiler.hooks.run.tapAsync (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\CachePlugin.js:52:13)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapable\lib\HookCodeFactory.js:33:10), :7:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapable\lib\Hook.js:154:20)
    at hooks.beforeRun.callAsync.err (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:315:19)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapable\lib\HookCodeFactory.js:33:10), :15:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.run (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpack\lib\Compiler.js:312:24)
    at Observable.rxjs_1.Observable.obs [as _subscribe] (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\@angular-devkit\build-webpack\0.803.19_3ba7dbe725fa57eb3196b9b4bddbe0c2\node_modules\@angular-devkit\build-webpack\src\webpack\index.js:44:33)
    at Observable._trySubscribe (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\rxjs\6.4.0\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe (C:\Code\angular\tt\node_modules\.pnpm\registry.npmjs.org\rxjs\6.4.0\node_modules\rxjs\internal\Observable.js:30:22)

🌍 Your Environment


                                                                      
     _                      _                 ____ _     ___          
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|         
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |          
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |          
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|         
                |___/                                                 
                                                                      
                                                                      
Angular CLI: 8.3.19                                                   
Node: 11.6.0                                                          
OS: win32 x64                                                         
Angular: 8.2.14                                                       
... animations, common, compiler, compiler-cli, core, forms           
... language-service, platform-browser, platform-browser-dynamic      
... platform-server, router                                           
                                                                      
Package                                    Version                    
--------------------------------------------------------------------  
@angular-devkit/architect                                      
@angular-devkit/build-angular              0.803.19                   
@angular-devkit/core                                           
@angular-devkit/schematics                                     
@angular/cli                               8.3.19                     
@nguniversal/module-map-ngfactory-loader   8.0.0-rc.1                 
@schematics/angular                                            
@schematics/update                                             
rxjs                                       6.5.3                      
typescript                                 3.5.3                      

PNPM: 4.30

Anything else relevant?
ng config -g cli.packageManager pnpm or npm doesn't really matter. Same with local configuration.

@ngbot ngbot bot added this to the Backlog milestone Nov 19, 2019
clydin added a commit to clydin/angular-cli that referenced this issue Nov 20, 2019
dgp1130 pushed a commit that referenced this issue Nov 20, 2019
dgp1130 pushed a commit that referenced this issue Nov 20, 2019
…e from project base

Closes #16219

(cherry picked from commit 316786d)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 21, 2019
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants