Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithNpm

Method
📦 Aspire.Hosting.JavaScript v17.0.0
func (JavaScriptAppResource) WithNpm(options ...*WithNpmOptions) JavaScriptAppResource

Signature

methodWithNpmbuilder
Configures the Node.js resource to use npm as the package manager and optionally installs packages before the application starts.
WithNpm(options ...*WithNpmOptions) JavaScriptAppResource
options...*WithNpmOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithNpmOptions argument.

Install*boolWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.
InstallCommand*stringThe install command itself passed to npm to install dependencies.
InstallArgs[]stringThe command-line arguments passed to npm to install dependencies.
JavaScriptAppResource

The resource builder.

Returns a handle; failures surface later via Err().

Applies to

This method applies to the following types: