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

Error adding @angular/fire to new workspace #7667

Closed
gonzalobustos opened this issue Nov 9, 2021 · 5 comments
Closed

Error adding @angular/fire to new workspace #7667

gonzalobustos opened this issue Nov 9, 2021 · 5 comments

Comments

@gonzalobustos
Copy link

gonzalobustos commented Nov 9, 2021

Current Behavior

I am getting a "Specified module path /apps/admin/apps/admin/src/app/app.module.ts does not exist" error message when trying to add @angular/fire to my angular Nx workspace and choosing features such as Authentication, Firestore or Cloud Functions.

I ran the command that the Nx CLI recommends, basically the same some folks suggest on this related question.

Expected Behavior

@angular/fire should be added without issues, just like @angular/material.

Steps to Reproduce

  1. Create a new Angular workspace
    npx create-nx-workspace nx-poc --preset=angular

  2. Add @angular/fire as recommended by the CLI, select Authentication or Firebase when asked about the features to setup and observe the error message
    npm install @angular/fire && npx nx g @angular/fire:ng-add

Failure Logs

Error: Specified module path /apps/admin/apps/admin/src/app/app.module.ts does not exist
    at Object.addToNgModule (/home/gonzalo/Projects/nx-poc/node_modules/@angular/fire/schematics/utils.js:143:15)
    at /home/gonzalo/Projects/nx-poc/node_modules/@angular/fire/schematics/setup/index.js:29:17
    at Generator.next (<anonymous>)
    at /home/gonzalo/Projects/nx-poc/node_modules/@angular/fire/schematics/setup/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/gonzalo/Projects/nx-poc/node_modules/@angular/fire/schematics/setup/index.js:4:12)
    at Object.setupProject (/home/gonzalo/Projects/nx-poc/node_modules/@angular/fire/schematics/setup/index.js:22:59)
    at /home/gonzalo/Projects/nx-poc/node_modules/@angular/fire/schematics/setup/index.js:122:23
    at Generator.next (<anonymous>)
    at fulfilled (/home/gonzalo/Projects/nx-poc/node_modules/@angular/fire/schematics/setup/index.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Specified module path /apps/admin/apps/admin/src/app/app.module.ts does not exist
(node:411339) UnhandledPromiseRejectionWarning: Error: Command failed: npm install @angular/fire && npx nx g @angular/fire:ng-add
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at /home/gonzalo/Projects/nx-poc/node_modules/@nrwl/cli/lib/init-local.js:73:41
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:411339) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:411339) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Environment

  Node : 14.15.4
  OS   : linux x64
  npm  : 6.14.10
  
  nx : 13.1.3
  @nrwl/angular : 13.1.3
  @nrwl/cli : 13.1.3
  @nrwl/cypress : 13.1.3
  @nrwl/devkit : 13.1.3
  @nrwl/eslint-plugin-nx : 13.1.3
  @nrwl/express : Not Found
  @nrwl/jest : 13.1.3
  @nrwl/linter : 13.1.3
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/nx-cloud : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 13.1.3
  @nrwl/web : Not Found
  @nrwl/workspace : 13.1.3
  @nrwl/storybook : 13.1.3
  @nrwl/gatsby : Not Found
  typescript : 4.3.5
@AgentEnder
Copy link
Member

Hey @gonzalobustos. I took a look at this and it appears to be caused by @angular/fire appending sourceRoot to the project's root when calculating the paths. I'd recommend temporarily changing the sourceRoot in your project configuration to be relative to its root, running the generator, and then changing it back.

This is something that will have to be fixed on their end, as it should be handled. I've opened an issue there to track it, and we can close this one out after we hear back from them. angular/angularfire#3052

@gonzalobustos
Copy link
Author

That makes total sense, @AgentEnder
Thanks for quickly looking into this!

@AgentEnder
Copy link
Member

No worries 😀. Since the problem is acknowledged on their side and I put a pr in over there I'm going to go ahead and close this out.

@AgentEnder
Copy link
Member

@gonzalobustos I think this should be fixed in latest AngularFire as a heads up

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants