Skip to content

npm run build fails on Windows #1799

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
johanchouquet opened this issue Jul 31, 2018 · 7 comments
Closed

npm run build fails on Windows #1799

johanchouquet opened this issue Jul 31, 2018 · 7 comments

Comments

@johanchouquet
Copy link
Contributor

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.

@hiepxanh
Copy link
Contributor

remove your node_modules then try to run npm test again

@jamesdaniels
Copy link
Member

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

@jamesdaniels jamesdaniels changed the title npm run build fails npm run build fails on Windows Aug 29, 2018
@hiepxanh
Copy link
Contributor

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

@johanchouquet
Copy link
Contributor Author

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

@johanchouquet
Copy link
Contributor Author

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.

@tja4472
Copy link

tja4472 commented Sep 20, 2018

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';

@johanchouquet
Copy link
Contributor Author

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.

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

4 participants