Angularfire: npm run build fails on Windows

Created on 31 Jul 2018  路  7Comments  路  Source: angular/angularfire

My initial intention was to contribute by submitting a PR. But, I ran into some issues on some points which are needed to do so:

Version info

Angular: 6.1

Firebase: 3.17.4

AngularFire: 5.0-rc.11

node: 9.5.0

Other (e.g. Ionic/Cordova, Node, browser, operating system): no

My OS: windows 10**

Steps to set up and reproduce

  • I just forked the repository
  • then I git cloned it.
  • then I npm installed it
  • then, npm run build fails directly.

Debug output

* Errors in the JavaScript console *

jct@CFLX-22 MINGW64 ~/code/16-angularfire2/angularfire2 (master)
$ npm test

[email protected] test C:\Users\jct\code\16-angularfire2\angularfire2
npm run build && karma start --single-run

[email protected] build C:\Users\jct\code\16-angularfire2\angularfire2
rm -rf dist && node tools/build.js

events.js:137
throw er; // Unhandled 'error' event
^

Error: spawn node_modules/.bin/ngc ENOENT
at _errnoException (util.js:1003:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
at onErrorNT (internal/child_process.js:389:16)
at process._tickCallback (internal/process/next_tick.js:152:19)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:190:16)
at bootstrap_node.js:662:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: rm -rf dist && node tools/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jct\AppData\Roaming\npm-cache_logs\2018-07-31T09_58_56_550Z-debug.log
npm ERR! Test failed. See above for more details.

jct@CFLX-22 MINGW64 ~/code/16-angularfire2/angularfire2 (master)
$ ng version

Angular CLI: 6.0.0
Node: 9.5.0
OS: win32 x64
Angular: 6.1.0
... common, compiler, compiler-cli, core, platform-browser
... platform-browser-dynamic, platform-server

Package Version

@angular-devkit/architect 0.6.0 (cli-only)
@angular-devkit/core 0.6.0 (cli-only)
@angular-devkit/schematics 0.6.0 (cli-only)
@schematics/angular 0.6.0 (cli-only)
@schematics/update 0.6.0 (cli-only)
rxjs 6.2.2
typescript 2.7.2

jct@CFLX-22 MINGW64 ~/code/16-angularfire2/angularfire2 (master)
$ firebase --version
3.17.4

jct@CFLX-22 MINGW64 ~/code/16-angularfire2/angularfire2 (master)
$ node -version
C:\Program Files\nodejs\node.exe: bad option: -version

jct@CFLX-22 MINGW64 ~/code/16-angularfire2/angularfire2 (master)
$ node -v
v9.5.0

Expected behavior

It should run ngc command in node_modules/.bin/ngc, but does not.

Actual behavior

It fails as the log indicates.

Is there anything that I did wrong ? I just followed what was indicated on the CONTRIBUTING.md page.

Most helpful comment

Try these changes.

package.json

    "build": "rimraf dist && node tools/build.js",

tools\build.js

// Constants for running typescript commands
const TSC = 'node_modules\\.bin\\tsc.cmd';
const NGC = 'node_modules\\.bin\\ngc.cmd';

All 7 comments

remove your node_modules then try to run npm test again

I believe we need to do some work to make our tooling Windows friendly.

yeah, forgot it, I build successful on Mac. it must be Window problem

Thanks for the effort if you work on that. I tried to rebuild from scratch, but same result.

Do you have any update on this ? I could work from times to times to contribute to the project, but for now, I can't. I'd be glad to contribute.

Try these changes.

package.json

    "build": "rimraf dist && node tools/build.js",

tools\build.js

// Constants for running typescript commands
const TSC = 'node_modules\\.bin\\tsc.cmd';
const NGC = 'node_modules\\.bin\\ngc.cmd';

Hi @tja4472 , thanks. It did the trick!

I had no more errors for the npm run build. Then, I tried npm run test, and everything went well.

I think i'm now able to contribute, even on windows. Not sure how to propose PR because of the necessary changes to tools/build.js & package.json files. But anyway, i can try.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leanvitale picture Leanvitale  路  3Comments

KLiFF2606 picture KLiFF2606  路  3Comments

martinyoussef picture martinyoussef  路  3Comments

harrylincoln picture harrylincoln  路  3Comments

avanderbergh picture avanderbergh  路  3Comments