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

[BUG] `au new project` never returns on windows with GIT Bash shell #859

Closed
3cp opened this issue Mar 27, 2018 · 27 comments

Comments

Projects
None yet
5 participants
@3cp
Copy link
Member

commented Mar 27, 2018

I'm submitting a bug report

  • Library Version:
    0.33.1

  • Operating System:
    Windows 10

  • Node Version:
    8.9.4 and 9.9.0

  • NPM Version:
    5.6.0, 5.8.0

  • Browser:
    N/A

  • Language:
    all

  • Loader/bundler:
    all

Current behavior:
au new project command never returns back to shell.

It does nothing after "Happy Coding!" or "Dependencies not installed." depending on whether you choose install the dependencies or not.

This issue was raised from https://discourse.aurelia.io/t/problems-with-the-cli/989
Read more there.

  • What is the expected behavior?
    Well, it should return.
  • What is the motivation / use case for changing the behavior?
@Alexander-Taran

This comment has been minimized.

Copy link
Member

commented Mar 27, 2018

does return for me.
on windows
with yarn

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 27, 2018

Must have some edge condition here.

Well, @si2030 and I are in similar timezone. Maybe we should ask @bigopon to try too.

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 27, 2018

Well, modify bin/aurelia-cli.js to explicitly exit solve this issue. But I have no idea what condition on the OS makes this mandatory. It seems to be a harmless fix though.

Update: this fix breaks au run.
Update: maybe not. Default cli also fails on au run (separate webpack issue).
Update: excluding webpack 4 issue. This fix doesn't work with au run or au run --watch, it terminates immediately.

cli.run(commandName, commandArgs)
  .then(() => {
    process.exit(); // add explicit exist
  })
  .catch((error) => {
      console.log(error);
      process.exit(1);
  });
@lancelot316

This comment has been minimized.

Copy link

commented Mar 28, 2018

I'm experiencing this same problem, only with git bash, power shell is fine. What I am noticing in task manager is this,

  1. When au new is run in git bash a node process appears in task manager
  2. if I choose to install project dependencies then a second node process appears in task manager, and
    when the 5 steps for that part of the process completes the second node process is killed. The first
    node process remains running
  3. If choose not install dependencies, no second node process is started, but the first process is never
    killed.

At no point, during the running of au new is the first node process ever killed. If I kill that process either using "End Task" in task manager or CRTL-C in git bash then the au new process completes, as you would expect.

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 28, 2018

@lancelot316 thx for your inside. Can you try modify your global cli's bin/aurelia-cli.js to see whether my fix works for you?

@lancelot316

This comment has been minimized.

Copy link

commented Mar 28, 2018

@huochunpeng your code will fix the “an new” problem, but it breaks “au run”

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 28, 2018

Thx, I did not try that.

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 28, 2018

It feels like something is holding some resource like file handler or socket, which prevents nodejs to exit.

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 28, 2018

@lancelot316 could you try another round of test without my fix?

I just found out with default cli 0.33.1 (by clean re-install npm i -g aurelia-cli), the au run doesn't work for me. It's weird, I remember it worked the day before yesterday.

@si2030, does au run work for you with default cli 0.33.1?

@lancelot316

This comment has been minimized.

Copy link

commented Mar 28, 2018

@huochunpeng no au run throws an error for me also but au run --watch works fine.
this is the error that I am getting with au run:

PS C:\projects\hello-world> au run
Starting 'configureEnvironment'...
Finished 'configureEnvironment'
Starting 'runWebpack'...
(node:11784) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Project is running at http://localhost:8080
webpack output is served from /
Content not from webpack is served from C:\projects\hello-world\dist
404s will fallback to /index.html
Finished 'runWebpack'
Hash: 62c4c99d7802a836699d
Version: webpack 4.3.0
Time: 5161ms
Built at: 2018-3-27 21:27:07
                                Asset       Size  Chunks                    Chunk Names
   app.62c4c99d7802a836699d.bundle.js   2.35 MiB     app  [emitted]  [big]  app
vendor.62c4c99d7802a836699d.bundle.js    489 KiB  vendor  [emitted]  [big]  vendor
                           index.html  589 bytes          [emitted]
Entrypoint app [big] = app.62c4c99d7802a836699d.bundle.js
Entrypoint vendor [big] = vendor.62c4c99d7802a836699d.bundle.js
[./node_modules/aurelia-bootstrapper/dist/native-modules/aurelia-bootstrapper.js] 5.17 KiB {app} [built]
[./node_modules/aurelia-loader-webpack/dist/native-modules/aurelia-loader-webpack.js] 14.4 KiB {app} [built]
[./node_modules/aurelia-pal/dist/native-modules/aurelia-pal.js] 2.18 KiB {app} [built]
[./node_modules/aurelia-polyfills/dist/native-modules/aurelia-polyfills.js] 24.4 KiB {app} [built]
[./node_modules/aurelia-webpack-plugin/runtime/empty-entry.js] 585 bytes {app} [built]
[./node_modules/aurelia-webpack-plugin/runtime/pal-loader-entry.js] 1.56 KiB {app} [built]
[./node_modules/bluebird/js/browser/bluebird.js] 175 KiB {vendor} {app} [built]
[./node_modules/bluebird/js/browser/bluebird.js-exposed] 65 bytes {vendor} {app} [built]
[./node_modules/process/browser.js] 5.29 KiB {vendor} {app} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 509 bytes {vendor} {app} [built]
[aurelia-framework] ./node_modules/aurelia-framework/dist/native-modules/aurelia-framework.js 13.8 KiB {app} [built]
[aurelia-pal-browser] ./node_modules/aurelia-pal-browser/dist/native-modules/aurelia-pal-browser.js 16.9 KiB {app} [buil
t]
[main] ./src/main.ts 1.09 KiB {app} [built]
   [0] multi aurelia-webpack-plugin/runtime/empty-entry aurelia-webpack-plugin/runtime/pal-loader-entry aurelia-bootstra
pper 52 bytes {app} [built]
   [1] multi bluebird 28 bytes {vendor} [built]
    + 65 hidden modules
Child html-webpack-plugin for "index.html":
         Asset      Size  Chunks  Chunk Names
    index.html  1.36 MiB       0
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./index.ejs] 1.03 KiB {0} [built]
    [./node_modules/lodash/lodash.js] 527 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 509 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 519 bytes {0} [built]
i 「wdm」: wait until bundle finished: /app.62c4c99d7802a836699d.bundle.js
i 「wdm」: wait until bundle finished: /vendor.62c4c99d7802a836699d.bundle.js
× 「wdm」: ConcurrentCompilationError: You ran Webpack twice. Each instance only supports a single concurrent compilation
at a time.
    at Compiler.run (C:\projects\hello-world\node_modules\webpack\lib\Compiler.js:149:37)
    at rebuild (C:\projects\hello-world\node_modules\webpack-dev-middleware\lib\context.js:81:24)
    at done (C:\projects\hello-world\node_modules\webpack-dev-middleware\lib\context.js:59:7)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\projects\hello-world\node_modules\tapable\lib\HookCodeFac
tory.js:24:12), <anonymous>:18:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\projects\hello-world\node_modules\tapable\lib\Hook.js:35:21)
    at emitRecords.err (C:\projects\hello-world\node_modules\webpack\lib\Compiler.js:201:22)
    at Compiler.emitRecords (C:\projects\hello-world\node_modules\webpack\lib\Compiler.js:313:39)
    at emitAssets.err (C:\projects\hello-world\node_modules\webpack\lib\Compiler.js:195:10)
    at hooks.afterEmit.callAsync.err (C:\projects\hello-world\node_modules\webpack\lib\Compiler.js:299:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\projects\hello-world\node_modules\tapable\lib\HookCodeFac
tory.js:24:12), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\projects\hello-world\node_modules\tapable\lib\Hook.js:35:21)
    at asyncLib.forEach.err (C:\projects\hello-world\node_modules\webpack\lib\Compiler.js:296:27)
    at done (C:\projects\hello-world\node_modules\neo-async\async.js:2809:11)
    at C:\projects\hello-world\node_modules\neo-async\async.js:2760:7
    at MemoryFileSystem.writeFile (C:\projects\hello-world\node_modules\memory-fs\lib\MemoryFileSystem.js:328:9)
    at writeOut (C:\projects\hello-world\node_modules\webpack\lib\Compiler.js:282:29)

I'm not getting the (node:11784) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead warning or the error with au run --watch

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 28, 2018

As a Mac user, I tried.

Some Windows master needs to jump in here.

The problem is we don’t know what edge condition on Windows triggers this issue.

It seems like majority of Windows users are not affected.

@JeroenVinke

This comment has been minimized.

Copy link
Member

commented Mar 28, 2018

The webpack error is known : #852. Webpack is looking into it.

Any information to reproduce is welcome

@Alexander-Taran

This comment has been minimized.

Copy link
Member

commented Mar 28, 2018

I bet it is again some external dependency... like node (-:
Maybe something changed in how it treats promises?

@JeroenVinke

This comment has been minimized.

Copy link
Member

commented Mar 28, 2018

This one is likely related: #269, but without a way to reproduce the problem it’s difficult to debug and fix

@lancelot316

This comment has been minimized.

Copy link

commented Mar 28, 2018

This is likely related to these two issues.
nodejs #5620
git for windows #738

if I pull up a cmd window and run "C:\Program Files\Git\usr\bin\bash.exe" -l -i
command as one of the commenters suggests and then run the au new command everything works as expected.

@fkleuver

This comment has been minimized.

Copy link
Member

commented Mar 28, 2018

It is related to webpack 4.2. I have intentionally left all my webpack dependencies at version 4.1.1 when I first saw this issue mentioned and have not had this problem even once.

As a workaround, you can use the --watch flag. This only happens without that flag (which puts webpack into lazy loading mode)

@Alexander-Taran

This comment has been minimized.

Copy link
Member

commented Mar 28, 2018

to summarize - au new - not working because of git bash
au run not working because of webpack.
issue for webpack is created and is tracked

to workaround git bash - use bloody cmd (-:

right?

@lancelot316

This comment has been minimized.

Copy link

commented Mar 28, 2018

@Alexander-Taran Yes, au new works fine for me in both power shell and cmd. It is just git bash that has the problem.

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 28, 2018

@JeroenVinke tested in requirejs based app, my previous fix in bin/aurelia-cli.js totally destroys au run and au run --watch.

To improve compatibility with GIT bash shell on Windows. It is possible to create a new activity in
lib/commands/new/new-application.json to explicitly exit after project-install.

{
    "id": 1100,
    "type": "project-install"
    // currently project-install has no nextActivity
    "nextActivity": point_to_new_activitiy_for_exit
},

@Alexander-Taran a proper shell is very important for non-Windows users 😄
It is all about the muscle memory on my fingers.

@3cp 3cp changed the title [BUG] `au new project` never returns on windows [BUG] `au new project` never returns on windows with GIT Bash shell Mar 28, 2018

@Alexander-Taran

This comment has been minimized.

Copy link
Member

commented Mar 28, 2018

proper shell would be proper bash on windows.. which is totally supported in windows 10
https://docs.microsoft.com/en-us/windows/wsl/about

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 28, 2018

Thx, will try that.

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 29, 2018

Indeed, that bash is a proper shell. It works.
Only complain is that the ubuntu subsystem in Windows is bit out of date, the node and npm versions are quite old.

@Alexander-Taran

This comment has been minimized.

Copy link
Member

commented Mar 29, 2018

apt-get is your friend.. I think (-:
it is a truthy lixux

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 29, 2018

Yes, I am talking about the nodejs/npm versions installed by apt-get.

I might use nodenv to get better nodejs.

@Alexander-Taran

This comment has been minimized.

Copy link
Member

commented Mar 29, 2018

Can't you add another source?
there

@3cp

This comment has been minimized.

Copy link
Member Author

commented Mar 29, 2018

Probably yes. But using nodenv can avoid apt-get and sudo.

Doesn't matter, I can keep using and testing nodejs v4 (which I never did) on Windows.

@Alexander-Taran

This comment has been minimized.

Copy link
Member

commented Mar 29, 2018

can be closed then

@3cp 3cp closed this Mar 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.