tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

symlink() function is unimplemented on this machine error in windows #114

Open hwwan80 opened 9 years ago

hwwan80 commented 9 years ago

When I try to use ember-cli-rails in windows, the following exception error when visit the url:

NotImplementedError (symlink() function is unimplemented on this machine):

ember-cli-rails (0.1.11) lib/ember-cli/app.rb:201:in `symlink'
ember-cli-rails (0.1.11) lib/ember-cli/app.rb:201:in `make_symlink'
ember-cli-rails (0.1.11) lib/ember-cli/app.rb:201:in `symlink_to_assets_root'
ember-cli-rails (0.1.11) lib/ember-cli/app.rb:165:in `prepare'
ember-cli-rails (0.1.11) lib/ember-cli/app.rb:32:in `run'
ember-cli-rails (0.1.11) lib/ember-cli-rails.rb:83:in `block in each_app'
ember-cli-rails (0.1.11) lib/ember-cli-rails.rb:83:in `each'
ember-cli-rails (0.1.11) lib/ember-cli-rails.rb:83:in `each_app'
ember-cli-rails (0.1.11) lib/ember-cli-rails.rb:47:in `run!'
ember-cli-rails (0.1.11) lib/ember-cli/middleware.rb:23:in `enable_ember_cli'
ember-cli-rails (0.1.11) lib/ember-cli/middleware.rb:8:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.1.4) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.1.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
activerecord (4.1.4) lib/active_record/migration.rb:380:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.4) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.4) lib/rails/engine.rb:514:in `call'
railties (4.1.4) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
c:/Ruby200/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
c:/Ruby200/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
c:/Ruby200/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

Running in Windows 7 Enterpise with administrator right

rwz commented 9 years ago

I do not own a Windows machine and can't fix this issue. Any help here would be welcome.

nruth commented 9 years ago

http://www.ember-cli.com/#symlinks-on-windows says it's an access control policy issue, i.e. run as admin, or failing that have the plugin fall back on copying files when symlinking isn't available.

rwz commented 9 years ago

@nruth this issue has nothing to do with ember-cli

swelham commented 9 years ago

The issue here is that windows doesn't support symlinks in the same way. See my PR #136 which solves this issue (based on my tests) using the mklink windows command.

nruth commented 9 years ago

@rwz OK, I'll leave you to it then.

rwz commented 9 years ago

I can create a branch and start working on windows support. However I need people to voluntarily help me testing it since I don't own a Windows machine.

JanJacobs commented 9 years ago

I want to volunteer for testing on Windows.

I am currently using it and had to make changes to ember-cli-rails-0.3.5 to make it work on Windows.

I had to implement #114 with a change to ember-cli\app_win.rb OLD:

@ember_path ||= app_path.join

NEW:

ember_path ||= Rails.root.join

I also had change to the ember-cli\runner.rb because Process.getpgid is not supported on Windows. OLD:

    def still_running?
      Process.getpgid app.pid
      true
    rescue Errno::ESRCH # no such process
      false
    end

NEW:

   def still_running?
      Process.kill 0, app.pid
      true
    rescue TypError #Errno::ESRCH - no such process, Errne::EPERM
      false
    end
seanpdoyle commented 8 years ago

We're sorry that this issue has sat for so long.

The project is now maintained by thoughtbot, and we're declaring an issue bankruptcy of sorts.

We're closing this issue. If what you've described is still a problem, please comment on this issue and we'll reopen.

@JanJacobs those changes look promising, would you mind opening a PR to help with windows support?

Thanks for your patience.

wjdhamilton commented 8 years ago

:+1: Still have this problem on windows 7 using Rails 4.2.4 and ember-cli-rails 0.5.3 with corresponding ember-cli-rails-addon

seanpdoyle commented 8 years ago

Would anyone still seeing this problem pleae try out:

Each of those branches has up-to-date README's.

wjdhamilton commented 8 years ago

Unfortunately I still get the symlink() function is unimplemented on this machine error.

Gemfile:

source 'https://rubygems.org'

gem 'ember-cli-rails', git: 'git@github.com:thoughtbot/ember-cli-rails.git'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

and package.json from ember:

{
  "name": "frontend",
  "version": "0.0.0",
  "description": "Small description for frontend goes here",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "build": "ember build",
    "start": "ember server",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "^2.1.2",
    "ember-cli": "1.13.8",
    "ember-cli-app-version": "0.5.0",
    "ember-cli-babel": "^5.1.3",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-dependency-checker": "^1.0.1",
    "ember-cli-htmlbars": "0.7.9",
    "ember-cli-htmlbars-inline-precompile": "^0.2.0",
    "ember-cli-ic-ajax": "0.2.1",
    "ember-cli-inject-live-reload": "^1.3.1",
    "ember-cli-qunit": "^1.0.0",
    "ember-cli-rails-addon": "git+https://github.com/rondale-sc/ember-cli-rails-addon.git#a5d2cf050dce8d943f1eced990a535a8f6e7ac11",
    "ember-cli-release": "0.2.3",
    "ember-cli-sri": "^1.0.3",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "1.13.8",
    "ember-disable-proxy-controllers": "^1.0.0",
    "ember-export-application-global": "^1.0.3"
  }
}

Running on 64-bit Windows 7 Professional Service Pack 1

JanJacobs commented 8 years ago

I implemented the changes from swelham "The issue here is that windows doesn't support symlinks in the same way. See my PR #136 which solves this issue (based on my tests) using the mklink windows command."

Additionally I had to make the following changes

_ember-cli\appwin.rb OLD:

@ember_path ||= app_path.join

NEW:

ember_path ||= Rails.root.join

I also had change to the ember-cli\runner.rb because Process.getpgid is not supported on Windows. OLD:

    def still_running?
      Process.getpgid app.pid
      true
    rescue Errno::ESRCH # no such process
      false
    end

NEW:

   def still_running?
      Process.kill 0, app.pid
      true
    rescue TypError #Errno::ESRCH - no such process, Errne::EPERM
      false
    end

I using 64-bit Windows 10 Pro.

seanpdoyle commented 8 years ago

@wjdhamilton it sounds like you're running off of master.

To run the branches I suggested, you'll need to modify your Gemfile and Ember's package.json:

# Gemfile

gem 'ember-cli-rails', github: 'thoughtbot/ember-cli-rails', branch: 'remove-sprockets'
{
 "devDependencies": {
    "ember-cli-rails-addon": "rondale-sc/ember-cli-rails-addon#remove-sprockets",
  }
}
seanpdoyle commented 8 years ago

@JanJacobs thanks for sharing those Windows fix proposals.

Unfortunately, I don't have access to a Windows machine to verify their validity.

There is a branch that introduces AppVeyor for CI testing:

https://github.com/thoughtbot/ember-cli-rails/pull/291

Would you mind helping to create windows versions of:

Once we have setup parity across platforms, we can start to ensure the Windows version behaves the same as other Operating Systems versions.

JanJacobs commented 8 years ago

I want to help, yes please. Just a bit crazy at the office at the moment, by next week most of SA is on holiday and then I can get some work done:))

wjdhamilton commented 8 years ago

@seanpdoyle I've just tried a fresh app with the two links that you suggested, however the app now reports: Noember-cliexecutable found forfrontend. Install it: $ cd C:/sites/ember-cli-rails-windows-test/frontend $ npm install. I have definitely run npm install in frontend.

grantvanhelsing commented 8 years ago

@wjdhamilton did you ever find the solution to this problem? I'm trying to hand over an app I wrote on a Mac to a Windows dev and he is getting the same error, been stuck on this for ages!

wjdhamilton commented 8 years ago

Unfortunately not - I bought a mac when Rails stopped working properly on Windows and never looked back! On 15 Aug 2016, at 08:08, Grant van Helsdingen notifications@github.com<mailto:notifications@github.com> wrote:

@wjdhamiltonhttps://github.com/wjdhamilton did you ever find the solution to this problem? I'm trying to hand over an app I wrote on a Mac to a Windows dev and he is getting the same error, been stuck on this for ages!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/thoughtbot/ember-cli-rails/issues/114#issuecomment-239741676, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHJwKp70sUxUW4vyKz7kLKMKNOJrPxVEks5qgBBrgaJpZM4Dv1hL.

kayakyakr commented 8 years ago

@1vanhelsing1 if you're still trying to hand this over to a windows dev, as of the 14942 build of the win 10 insider preview, you can now use ember-cli in windows bash.

I recommend having that be the official answer and close this issue.