Skip to content

Windows Build fails even in git bash #17894

Closed

Description

@yoosif0

I'm submitting a ...


[ ] Regression (behavior that used to work and stopped working in a new release)
[X] Bug report 
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Windows fails when building build.sh

Cannot find module './src/common/angular1'
Cannot find module './src/common/downgrade_component'
Cannot find module './src/common/downgrade_injectable'.
Cannot find module './src/common/version'.
Cannot find module './src/static/upgrade_component'.
Cannot find module './src/static/upgrade_module'.

Activity

  1. wizarrc commented on Jul 2, 2017

    @wizarrc

    Same here. I even tried downgrading node and npm to versions specified in the DEVELOPER.md doc, which btw are below LTS.

  2. wizarrc commented on Jul 2, 2017

    @wizarrc

    May be related to #16846 where it talks about build.sh requires full Linux environment.

  3. wizarrc commented on Jul 2, 2017

    @wizarrc

    A workaround would be to:

    1. navigate to angular\packages\upgrade\static> in command prompt
    2. rename src to something like src.old
    3. create symlink mklink /J "src" "..\src"

    Step 3 requires administrator elevation except for later version of Windows 10 I believe.

    I haven't figured out how to add that to the create-symlinks.sh scripts file yet. Shouldn't be too hard though.

    That got me a bit further.

    Update The next bug I ran into and it's workaround:

    ./build.sh: line 444: rsync: command not found

    A workaround for running rsync on git for windows bash is blogged here:
    https://alanbarber.com/2015/08/11/installing-rsync-on-windows/

    For newer versions of git for windows, copy 5 files instead (rsync.exe, msys-1.0.dll, msys-iconv-2.dll, msys-intl-8.dll, and msys-popt-0.dll) from MinGW (C:\MinGW\msys\1.0\bin), after installing the rsync to the Program Files\Git\mingw64\bin directory (Program Files (x86) for 32-bit git in 64-bit windows).
    rsync

    Next bug that I hit is TypeError: base64 is not a function
    base64

    I looked up that error and found this on stack overflow:
    https://stackoverflow.com/questions/43275778/angular-2-aot-typeerror-base64-is-not-a-function

    Looks like node requires version 6+ but in the DEVELOPER.md requires < 6. I'm not sure if the document needs to be updated or not.

    Update 2 After installing node 6.11.0, I ran ./build/sh again and got this error: The source and destination cannot both be remote. for rsync.

    https://stackoverflow.com/questions/29941966/rsync-cwrsync-in-gitbash-the-source-and-destination-cannot-both-be-remote

    I looked into it, and it appears that rsync cannot use /c/ in the base path because it won't be able to resolve it or something, so they suggested fix is to first change directory then use relative paths.

    I modified build.sh to do such thing. I added RSYNC_SRC_DIR, RSYNC_OUT_DIR, and RSYNC_NPM_DIR replacing the non RSYNC versions in every rsync command. It appears rsync was added to angular in February. Before I call rsync I first change the directory to the PWD which is the project root path. rsync prompts the user with a dialog box for the firewall to open tcp and udp ports.

    SRC_DIR=${ROOT_DIR}/${PACKAGE}
    RSYNC_SRC_DIR=packages/${PACKAGE}
    ROOT_OUT_DIR=${PWD}/dist/packages
    OUT_DIR=${ROOT_OUT_DIR}/${PACKAGE}
    RSYNC_OUT_DIR=dist/packages/${PACKAGE}
    NPM_DIR=${PWD}/dist/packages-dist/${PACKAGE}
    RSYNC_NPM_DIR=dist/packages-dist/${PACKAGE}
    
    ...
    
    if [[ ${BUNDLE} == true ]]; then
    
    ...
    
        echo "======        Copy ${PACKAGE} typings"
        cd ${PWD}
        rsync -a --exclude=*.js --exclude=*.js.map ${RSYNC_OUT_DIR}/ ${RSYNC_NPM_DIR}
        moveTypings ${NPM_DIR} ${PACKAGE}
    
        (
    
    ...
    
        ) 2>&1 | grep -v "as external dependency"
      else
        echo "======        Copy ${PACKAGE} node tool"
        cd ${PDW}
        rsync -a ${RSYNC_OUT_DIR}/ ${RSYNC_NPM_DIR}
      fi
    
      echo "======        Copy ${PACKAGE} package.json and .externs.js files"
      cd ${PWD}
      rsync -am --include="package.json" --include="*/" --exclude=* ${RSYNC_SRC_DIR}/${RSYNC_NPM_DIR}/
      rsync -am --include="*.externs.js" --include="*/" --exclude=* ${RSYNC_SRC_DIR}/ ${RSYNC_NPM_DIR}/
    

    I now am stuck at a bunch of warning messages. I'm not really sure where to go from here. It doesn't move forward, just hangs at this spot:

    rsync2

  4. kumvem commented on Sep 5, 2017

    @kumvem

    @wizarrc Did you solve the build issue? I followed similar steps to solve build issues. stuck with the following warning message.

    /c/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js
    WARN: Dropping unreachable code [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:224,8]
    WARN: Declarations in unreachable code! [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:224,8]
    WARN: Dropping unreachable code [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:265,8]
    WARN: Declarations in unreachable code! [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:265,8]
    WARN: Dropping unreachable code [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:1401,4]
    WARN: Declarations in unreachable code! [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:1401,4]
    WARN: Dropping unreachable code [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:9207,4]
    WARN: Declarations in unreachable code! [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:9207,4]
    WARN: Dropping unreachable code [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:13499,12]
    WARN: Declarations in unreachable code! [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:13499,12]
    WARN: Side effects in initialization of unused variable Renderer2Interceptor [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js:5369,4]
    /c/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core.umd.js.map
    /c/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core-testing.umd.js
    WARN: Side effects in initialization of unused variable pendingTimers [C:/kumaran/open-source/angular/angular/dist/packages-dist/core/bundles/core-testing.umd.js:452,8]

  5. wizarrc commented on Sep 5, 2017

    @wizarrc

    @kumvem never got it to work, I gave up for now, hoping others could startup where I failed.

  6. snerks commented on Sep 17, 2017

    @snerks

    I followed the steps provided by @wizarrc, above (thanks!), with similar results.

    As an additional step, I tried the suggestion, in #12454, to remove a call to grep in build.sh:

    Search for the line:
    ) 2>&1 | grep -v "as external dependency"

    In my build.sh file, it was near line 440.

    Truncate the line, to remove the grep call, such that it now reads:

    ) 2>&1

    Launch the MINGW64 version of bash.exe as Administrator:
    Navigate to the project root folder
    ./build.sh

    Takes a while - but the build completes.

    I do not know if there is a negative effect caused by removal of the grep call.

  7. added this to the needsTriage milestone on Feb 28, 2018
  8. 4F2E4A2E commented on Jun 28, 2018

    @4F2E4A2E

    @snerks I just did try it out on master and it did not work:

    $ ./build.sh
    ====== BUILDING: Version 6.1.0-beta.3-fd57fe845
    
    ===> build.sh build tools ==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==
    ====== (tools)COMPILING: $(npm bin)/tsc -p ./tools/tsconfig.json =====
    <=== build.sh build tools <==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<=
    
    
    ===> build.sh clean dist ==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>
    <=== build.sh clean dist <==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==
    
    
    ===> build.sh copy e2e files ==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==
    ====== Copying files needed for e2e tests =====
    
    
    
    ====== Copying files needed for benchmarks =====
    ln: failed to create symbolic link './polymer': No such file or directory
    
  9. gauravmahto commented on Dec 28, 2018

    @gauravmahto

    @kara @benlesh @IgorMinar @vsavkin @petebacondarwin @vicb @tbosch @pkozlowski-opensource
    @matsko @alxhub

    Sorry! for mentioning so many people. I hope to bring more light to this.
    I just want to contribute to this project and so I just started by forking the project and got stuck in the first phase i.e. to build this project. I'm not an expert and don't know how to move forward with the build and stuff and so I'm politely asking that PLEASE show some love to the Windows users. Can we bring some people to get a look into this issue? I know that everybody is busy and this is too much to ask but please help us to contribute.

  10. StephenFluin commented on Dec 28, 2018

    @StephenFluin
    Contributor

    We definitely want to do better for Windows users. If you've been following along, things have gotten better over the last few months (fewer / different types of errors), but there's still more to go before our Windows support for building Angular is on par with Linux/Mac. Currently we're working on migrating more of our build and test infrastructure into being managed by Bazel so that it relies less on OS-specific binaries and packages, but we're not there yet.

  11. manklu commented on Dec 29, 2018

    @manklu

    @gauravmahto There are several free virtualization possibilities. Getting a linux environment until a native Windows build is supported, is no big deal.

  12. gauravmahto commented on Dec 30, 2018

    @gauravmahto

    @manklu I know that getting a virtual Linux environment is no big deal and that's exactly what I've been trying to accomplish from past 2 days. But you see that this is not about just setting up a Linux environment as one should be aware of intricacies of such environment; one that they are not familiar of. For e.g.: A windows may not be aware of how to be productive in a Linux environment and more importantly, the how to properly set up such environment so that they can easily build, test and debug the software.

    What I'm trying to say is it is very hard for a Windows user to help and contribute to such an awesome framework just because it is not so easy to start with.

  13. gkalpak commented on Dec 30, 2018

    @gkalpak
    Member

    I know docs/DEVELOPER.md is still mentioning build.sh and test.sh, but I am not sure they still work.
    I am on Windows too and the way I build and test Angular is by using the Windows Subsystem for Linux and running the bazel commands described in docs/BAZEL.md (plus running scripts/build-packages-dist.sh if I need to build all packages as they are published to npm).

    UPDATE: I added a TODO item here to update DEVELOPER.md, once the transition to bazel is completed.

  14. gauravmahto commented on Dec 31, 2018

    @gauravmahto

    @gkalpak This is good information. A huge thanks to you for pointing me in the right direction. 🥇

    Also, thank you for adding the TODO item.

    Wishing everybody a joyous happy new year.

  15. gkalpak commented on Mar 27, 2019

    @gkalpak
    Member

    I am going to close this, since build.sh (the script mentioned originally) has since been removed and we have moved on to bazel.
    There are probably more issues there, but they are different than the ones reported here. If you are running into problems with the bazel-based setup, please open a new issue.

  16. s-gbz commented on May 10, 2019

    @s-gbz
    Contributor

    @gkalpak is scripts/build-packages-dist.sh supposed to work? It doesn't for me, because command "." could not be found

  17. gkalpak commented on May 13, 2019

    @gkalpak
    Member

    No, I don't think it is supposed to work on Windows. We are in the process of adding Windows to the platforms we test on CI (see the .codefresh/ directory for more details on what we have atm), but we have still work to do.

    For now, I am either using WSL (which is easy to set up, but slow - but also about to get much faster) or a linux-based docker image to build and run bazel stuff.

  18. gkalpak commented on May 13, 2019

    @gkalpak
    Member

    In case it helps, this Dockerfile works for me:

    FROM circleci/node:10-browsers
    EXPOSE 4200 9876
    USER root
    RUN npm config --global set user root
    
  19. angular-automatic-lock-bot commented on Sep 15, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  20. locked and limited conversation to collaborators on Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: build & ciRelated the build and CI infrastructure of the projectfreq1: low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions