# JavaScriptAppResource.WithYarn

- Module: [Aspire.Hosting.JavaScript](/reference/api/go/aspire.hosting.javascript.md)
- Defined on: [JavaScriptAppResource](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md)
- Version: `17.0.0`
- Kind: `method`

Configures the Node.js resource to use yarn as the package manager and optionally installs packages before the application starts.

## Definition

```go
type JavaScriptAppResource interface {
    // ... omitted for brevity
    WithYarn(options ...*WithYarnOptions) JavaScriptAppResource
}
```

## Signature

```go
WithYarn(options ...*WithYarnOptions) JavaScriptAppResource
```

## Parameters

- `options` (`...*WithYarnOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithYarnOptions` argument.

- `Install` (`*bool`) -- When true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.
- `InstallArgs` (`[]string`) -- The command-line arguments passed to "yarn install".

## Returns

[`JavaScriptAppResource`](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md) -- The resource builder.

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

## Defined on

- [JavaScriptAppResource](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md) -- `handle`
