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

deploy error if outputPath.browser is not set #196

Open
ago1024 opened this issue Nov 17, 2024 · 2 comments
Open

deploy error if outputPath.browser is not set #196

ago1024 opened this issue Nov 17, 2024 · 2 comments

Comments

@ago1024
Copy link

ago1024 commented Nov 17, 2024

I'm using [email protected] to deploy project converted from older angular versions to angular 18 with the new build system.

The angular builder configuration has

"outputPath": {
  "base": "dist"
}

"browser" is not set as it has the default value of browser. https://v17.angular.io/guide/workspace-config#output-path-configuration

ng deploy will fail with

❌ An error occurred when trying to deploy:
The "path" argument must be of type string. Received undefined

Changing the angular builder configuration to

"outputPath": {
  "base": "dist",
  "browser": "browser"
}

fixes the error.

This is caused by deploy/actions.ts where "obj.browser" is expected to have a value.

    if (typeof buildOptions.outputPath === 'string') {
      dir = path.join(buildOptions.outputPath, 'browser');
    } else {
      const obj = buildOptions.outputPath as any;
      dir = path.join(obj.base, obj.browser)  <--- Error
    }
@fmalcher
Copy link
Member

fmalcher commented Nov 17, 2024

Thanks for the report! I'm not sure whether we can actually handle all edge cases completely, but I think it's possible to detect this.

Can you please try defining the deploy directory manually in the builder options? This would be the recommended workaround.

"deploy": {
  "builder": "angular-cli-ghpages:deploy",
  "options": {
    "dir": "dist/browser"
  }
}

If this works, we probably will not make this a priority. However, pull requests are welcome, so we really appreciate your help 😊

@fmalcher
Copy link
Member

For reference, the current docs page: https://angular.dev/reference/configs/workspace-config

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