Skip to content

Exception while running command: ng run x:deploy #2088

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

Closed
meness opened this issue May 29, 2019 · 25 comments · Fixed by #2279 or TypescriptID/angularfire2#80
Closed

Exception while running command: ng run x:deploy #2088

meness opened this issue May 29, 2019 · 25 comments · Fixed by #2279 or TypescriptID/angularfire2#80

Comments

@meness
Copy link

meness commented May 29, 2019

Version info

Angular: 8.0.0

Firebase: 6.1.0

AngularFire: 5.2.0-rc.1

OS: Windows 10 Pro (Version: 1809)

How to reproduce these conditions

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

Steps to set up and reproduce

Sample data and security rules

Debug output

Errors in the JavaScript console

C:\Users\X\Documents\X\X\X>ng run Admin:deploy
ENOENT: no such file or directory, open '\C\Users\X\Documents\X\X\X\.firebaserc'
Error: ENOENT: no such file or directory, open '\C\Users\X\Documents\X\X\X\.firebaserc'
    at Object.openSync (fs.js:431:3)
    at Object.readFileSync (fs.js:333:35)
    at Object.getFirebaseProjectName (C:\Users\X\Documents\X\X\X\node_modules\@angular\fire\schematics\utils.js:53:41)
    at Object.<anonymous> (C:\Users\X\Documents\X\X\X\node_modules\@angular\fire\schematics\deploy\builder.js:26:37)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\X\Documents\X\X\X\node_modules\@angular\fire\schematics\deploy\builder.js:4:58)

Output from firebase.database().enableLogging(true);

Screenshots

Expected behavior

Running the following command ng run x:deploy have to successfully build and deploy the project to Firebase Hosting.

Note: the x above is the project name.

Actual behavior

Fails at the beginning to find .firebaserc file but it exists. I figured out the path \C\Users\X\Documents\X\X\X\.firebaserc is wrong.

@jamesdaniels
Copy link
Member

Did you first run ng add @angular/fire@next? If so I'll run this on a Windows machine at next opportunity and find the problem with the schematic.

@meness
Copy link
Author

meness commented May 30, 2019

Did you first run ng add @angular/fire@next? If so I'll run this on a Windows machine at next opportunity and find the problem with the schematic.

Yes, I did. Thanks!

@PastaBolo
Copy link

Hi ! Amazing command ! But I got the same issue 😞

Angular 8 + ng add @angular/fire@next

Works on Linux but not on Windows

@kostenickj
Copy link

Im getting the same issue.

@msivri
Copy link

msivri commented Jun 7, 2019

I have the same problem with angular 8 on windows. This issue helped me: #2101

@iamkanishka
Copy link

got the same issue

@ngdevelop-tech
Copy link

Getting same issue with Angular 8.2.0 and @angular/[email protected]

@Jeanlo
Copy link

Jeanlo commented Aug 20, 2019

Same issue. I'm using @angular/core 8.2.0 and @angular/fire 5.2.1.

@emapettinato
Copy link

Same Issue: testing deploy angular cli 8.3.0 @angular/fire 5.2.1 windows 10

@Crisp3333
Copy link

Crisp3333 commented Aug 23, 2019

Same problem on windows.

This is what I did to launch my application:
(1) make sure public directory is set to dist/<project name> All the tutorials says dist but that does not work. It needs the project folder path.
(2) since ng deploy does not work and ng build --prod gives errors, I use ng build.
(3) After I did all the above I do firebase deploy and that's it. That means @angular/fire was practically not used.

@JoeWorker
Copy link

Updated Node to latest
Angular cli to latest
yarn still shows as 1.15.2 though I updated that too 0_o
did a ng update --all
then requested rxjs be updated explicitly

Same error and result

Can concur with Crisp3333, bypassed the new command a few weeks ago with the manual process.

@IdanCo
Copy link

IdanCo commented Sep 6, 2019

Same issue on Windows 10 | @angular/cli 8.3.3 | @angular/fire 5.2.1

C:\Users\User\projects\test> ng deploy
An unhandled exception occurred: ENOENT: no such file or directory, open '\C\Users\User\projects\test\.firebaserc'
See "C:\Users\User\AppData\Local\Temp\ng-dWxjal\angular-errors.log" for further details.

@FerLuisxd
Copy link

same issue on windows 10 and stable node version

@ngdevelop-tech
Copy link

ngdevelop-tech commented Sep 8, 2019

I am able to fix this issue by doing the following changes :

In \node_modules@angular\fire\schematics\utils.js > In getFirebaseProjectName method
replace
const { targets } = JSON.parse(fs_1.readFileSync(path_1.join(projectRoot, ".firebaserc"), "UTF-8"));
with
const { targets } = JSON.parse(fs_1.readFileSync(".firebaserc", "UTF-8"));

and In \node_modules@angular\fire\schematics\deploy\builder.js
replace
yield actions_1.default(require("firebase-tools"), context, core_1.join(workspace.root, project.root), firebaseProject);
with
yield actions_1.default(require("firebase-tools"), context, project.root, firebaseProject);

@salgadoguiller
Copy link

Any update on this?

@ericsoucy
Copy link

ericsoucy commented Sep 20, 2019

any updates ? , it should work on windows,
@ngdevelop-tech has it right

@Ondrashisko
Copy link

Ondrashisko commented Sep 26, 2019

Ive just deployed with ng deploy, which doesnt work form me before.
rewriting utils.js an buider. js like described below helps.

@juanri0s
Copy link

Same issue here. The best solution currently seems to be avoiding ng deploy for now and just following the normal firebase CLI deploy option.

@chadbr
Copy link

chadbr commented Oct 1, 2019

trying to use this for the 1st time -- same issue 👎

@Sangarllo
Copy link

Same for me, using both:

ng run [ANGULAR_PROJECT_NAME]:deploy

or

ng deploy

@leodecm3
Copy link

@ngdevelop-tech that fixed the insue for me, thanks!
#2088 (comment)

@adityacodes
Copy link

Temporary workaround if you don't want to change the core files:
Add "deploy" : "ng build && firebase deploy" to scripts in package.json
Run: npm run deploy.

ngdevelop-tech added a commit to ngdevelop-tech/angularfire2 that referenced this issue Oct 13, 2019
When we execute `ng deploy` command, `workspace.root` gives wrong path in Windows environment, thats why it doesn't work in Windows environment.
Using only `project root` In `getFirebaseProjectName` and `deploy`, will  successfully allow `ng deploy` while executing it at project root in windows and linux environment.
fixes angular#2088
@rlee1990
Copy link

Any update on when this change will be added so we don't have to do this to the core files each time? @ngdevelop-tech

@ngdevelop-tech
Copy link

Any update on when this change will be added so we don't have to do this to the core files each time? @ngdevelop-tech

@rlee1990 PR is in progress. Soon will let you know for updates.

@diogomachado
Copy link

I has the same problem, i believe that the command don't understant the path correct of the file .firebaserc, in my case, he tried found \D\Unimed\projetos\app-unimedbr.firebaserc but the correct is D:\

alan-agius4 added a commit to alan-agius4/angularfire that referenced this issue Jan 3, 2020
Angular devkit paths are not interchangable with Node FS paths.

Closes angular#2088
alan-agius4 added a commit to alan-agius4/angularfire that referenced this issue Jan 3, 2020
Angular devkit paths are not interchangeable with Node FS paths.

Closes angular#2088
jamesdaniels pushed a commit that referenced this issue Jan 17, 2020
Angular devkit paths are not interchangeable with Node FS paths.

Closes #2088
jamesdaniels pushed a commit that referenced this issue Feb 2, 2020
Angular devkit paths are not interchangeable with Node FS paths.

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