Skip to content

express-engine: the request of a dependency is an expression #17604

@nweldev

Description

@nweldev

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Bugs in Ng Universal v8 forbid to reproduce this issue.
Tested with several v9 versions, bug stays the same.

Description

With @nguniversal/express-engine, when using a third-party package server-side, running ng run <project>:server:production or ng run <project>:serve-ssr fails.

🔬 Minimal Reproduction

https://github.com/noelmace/ngu-repro-spdx

  1. ng new reproduce
  2. ng add @nguniversal/express-engine
  3. npm i -d dd-trace graphql
  4. add src/tracer.ts:
import tracer from 'dd-trace';
tracer.init();
export default tracer;
  1. import src/tracer.ts in server.ts
  2. npm run build:ssr

🔥 Exception or Error

WARNING in ./node_modules/dd-trace/packages/dd-trace/src/platform/node/loader.js 144:11-31
Critical dependency: the request of a dependency is an expression

ERROR in ./node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-exceptions' in 'project/node_modules/spdx-expression-parse'

ERROR in ./node_modules/spdx-correct/index.js
Module not found: Error: Can't resolve 'spdx-license-ids' in 'project/node_modules/spdx-correct'

ERROR in ./node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-license-ids' in 'project/node_modules/spdx-expression-parse'

ERROR in ./node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-license-ids/deprecated' in 'project/node_modules/spdx-expression-parse'
this.debug is not a function

🌍 Your Environment

Angular CLI: 9.1.4
Node: 13.3.0
OS: linux x64

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

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.4
@angular-devkit/build-angular     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
@nguniversal/builders             9.1.0
@nguniversal/common               9.1.0
@nguniversal/express-engine       9.1.0
@schematics/angular               9.1.4
@schematics/update                0.901.4
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Anything else relevant?

$ npm list spdx-expression-parse      
ngu-repro-spdx@0.0.0
└─┬ @angular/cli@9.1.4
  └─┬ pacote@9.5.12
    └─┬ normalize-package-data@2.5.0
      └─┬ validate-npm-package-license@3.0.4
        ├─┬ spdx-correct@3.1.0
        │ └── spdx-expression-parse@3.0.0  deduped
        └── spdx-expression-parse@3.0.0 
$ npm list spdx-exceptions                     
ngu-repro-spdx@0.0.0
└─┬ @angular/cli@9.1.4
  └─┬ pacote@9.5.12
    └─┬ normalize-package-data@2.5.0
      └─┬ validate-npm-package-license@3.0.4
        └─┬ spdx-expression-parse@3.0.0
          └── spdx-exceptions@2.3.0 
$ npm list spdx-correct   
ngu-repro-spdx@0.0.0
└─┬ @angular/cli@9.1.4
  └─┬ pacote@9.5.12
    └─┬ normalize-package-data@2.5.0
      └─┬ validate-npm-package-license@3.0.4
        └── spdx-correct@3.1.0 
$ npm list spdx-license-ids            
ngu-repro-spdx@0.0.0 /home/noel/git/_sandbox_/ngu-repro-spdx
└─┬ @angular/cli@9.1.4
  └─┬ pacote@9.5.12
    └─┬ normalize-package-data@2.5.0
      └─┬ validate-npm-package-license@3.0.4
        ├─┬ spdx-correct@3.1.0
        │ └── spdx-license-ids@3.0.5 
        └─┬ spdx-expression-parse@3.0.0
          └── spdx-license-ids@3.0.5  deduped

Pacote was added by @clydin via #13483 at https://github.com/angular/angular-cli/blame/9.1.x/packages/angular/cli/utilities/package-metadata.ts#L15 and downgraded in v10 by @alan-agius4 via #17358.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions