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

Can't resolve 'child_process' and 'path' #725

Open
PantherGeek7 opened this issue Mar 1, 2022 · 1 comment
Open

Can't resolve 'child_process' and 'path' #725

PantherGeek7 opened this issue Mar 1, 2022 · 1 comment

Comments

@PantherGeek7
Copy link

I am currently trying to display the version number of my client-side Angular application on a special admin page. Here is what I am currently coding:

// Top of TypeScript file
import * as nbgv from "nerdbank-gitversioning";

// Inside class
public version: string;

// Inside class constructor
nbgv.getVersion()
    .then(r => this.version = r.version)
    .catch(e => console.error(e));

This is similar to the instructions given here: https://github.com/dotnet/Nerdbank.GitVersioning/blob/master/doc/node.md

Unfortunately, when I try to compile my application, I am getting these errors:

ERROR in ./node_modules/nerdbank-gitversioning/asyncprocess.js
Module not found: Error: Can't resolve 'child_process' in '\node_modules\nerdbank-gitversioning'
ERROR in ./node_modules/nerdbank-gitversioning/core.js
Module not found: Error: Can't resolve 'path' in '\node_modules\nerdbank-gitversioning'

What do I need to do in order to retrieve the version number of my build at runtime?

@AArnott
Copy link
Collaborator

AArnott commented Mar 17, 2022

Are you running in a node process, or a web browser? This npm package spawns a process so it won't work in a web browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants