Amber: Error in src/app.cr:1: while requiring "../config/*"

Created on 22 Oct 2017  Â·  13Comments  Â·  Source: amberframework/amber

Problem

#
I can't build, or watch my application.

Description

Error in src/FastApp.cr:1: while requiring "../config/*" require "../config/*" in config/application.cr:2: while requiring "amber" require "amber" in lib/amber/src/amber.cr:8: while requiring "redis": can't find file 'redis' relative to '/var/www/rdv/FastApp/lib/amber/src' require "redis"

Steps to Reproduce

  1. I have installed amber 0.3.0
  2. amber new FastApp
  3. cd FastApp
  4. amber watch

Versions

ubuntu 16
crystal 0.23.1
amber 0.3.0

Thanks

good-first-issue needs-more-details

All 13 comments

Did you ran ‘shards install’?

yes, the dependencies are here but in have a error after shards install:
git command failed: git archive --format=tar --prefix= master | tar -x -f - -C '/var/www/rdv/FastApp/lib/slang' (). Maybe a commit, branch or file doesn't exist?

@netwarp I can't reproduce this issue. Try this:

amber new FastApp -d sqlite -t ecr --deps
cd FastApp
amber watch

@netwarp Can't reproduce. In your steps you didn't list running shards install. This is very important to do everytime you create a new project.

Is redis installed on the server?

It's working. Thanks a lot :+1:

@netwarp - Can this issue be closed?

@marksiemers - Yes.
I just needed to install dependencies in sudo.
Thanks.

as in sudo shards install?
EDIT: did not fix the problem.
My scenario: I installed the basic app from the guide and pushed it up on github. The app is working fine. Then I changed my computer, pulled the project from Github.
I then ran shards install, amber db create, amber db migrate.
No error in any step.
I then tried amber watch and Thanos showed up.

````
rishav@Rishav-pc:/mnt/c/Users/risharan/Documents/GitHub/diggamber$ amber watch
12:02:56 Watcher | (INFO) Watching 19 files (server reload)...
12:02:56 Watcher | (INFO) Building project Amby...
Error in src/amby.cr:1: while requiring "../config/*"

require "../config/*"
^

in config/routes.cr:1: instantiating 'Amber::Server:Class#configure()'

Amber::Server.configure do |app|
^~~~~

in config/routes.cr:1: instantiating 'Amber::Server:Class#configure()'

Amber::Server.configure do |app|
^~~~~

in config/routes.cr:28: expanding macro

routes :web do
^

in macro 'routes' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/amber/src/amber/dsl/server.cr:2, line 1:

  1. router.draw :web, "" do

    1. #begin ##get(#"/profile", #UserController, #:show)

    2. #get(#"/profile/edit", #UserController, #:edit)

    3. #patch(#"/profile", #UserController, #:update)

    4. #get(#"/signin", #SessionController, #:new)

    5. #post(#"/session", #SessionController, #:create)

    6. #get(#"/signout", #SessionController, #:delete)

    7. #get(#"/signup", #RegistrationController, #:new)

    8. #post(#"/registration", #RegistrationController, #:create)

    9. #get(#"/", #HomeController, #:index)

    10. end#

    11. end

      13.

instantiating 'Amber::Router::Router#draw(Symbol, String)'
in config/routes.cr:28: expanding macro

routes :web do
^

in macro 'routes' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/amber/src/amber/dsl/server.cr:2, line 1:

  1. router.draw :web, "" do

    1. #begin ##get(#"/profile", #UserController, #:show)

    2. #get(#"/profile/edit", #UserController, #:edit)

    3. #patch(#"/profile", #UserController, #:update)

    4. #get(#"/signin", #SessionController, #:new)

    5. #post(#"/session", #SessionController, #:create)

    6. #get(#"/signout", #SessionController, #:delete)

    7. #get(#"/signup", #RegistrationController, #:new)

    8. #post(#"/registration", #RegistrationController, #:create)

    9. #get(#"/", #HomeController, #:index)

    10. end#

    11. end

      13.

instantiating 'Amber::Router::Router#draw(Symbol, String)'
in macro 'get' expanded macro: macro_140603438984032:2, line 1:

  1. route :get, "/profile", UserController, :show
    2.

    1. route :head, "/profile", UserController, :show

      4.

    2. route :get, "/profile", UserController, :show

      6.

    3. route :options, "/profile", UserController, :show

      8.

      9.

expanding macro
in macro 'route' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/amber/src/amber/dsl/router.cr:11, line 5:

  1. __temp_1183 = ->(context : HTTP::Server::Context){
  2. controller = UserController.new(context)
  3. controller.run_before_filter(:show) unless context.content
  4. unless context.content
    > 5. context.content = controller.show.to_s
  5. controller.run_after_filter(:show)
  6. end
  7. }
  8. __temp_1184 = "GET"

    1. __temp_1185 = Amber::Route.new(

    2. __temp_1184, "/profile", __temp_1183, :show, valve, scope, "UserController"

    3. )

      13.

    4. router.add(__temp_1185)

      15.

instantiating 'UserController#show()'
in macro 'render_template' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/amber/src/amber/controller/helpers/render.cr:33, line 2:

1.

  1. Kilt.render("src/views/layouts/application.slang")
    3.
    4.

expanding macro
in macro 'render' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/kilt/src/kilt.cr:22, line 1:

  1. String.build do |__kilt_io__|

    1. Kilt.embed("src/views/layouts/application.slang", "__kilt_io__", )

    2. end

      4.

instantiating 'String:Class#build()'
in /usr/share/crystal/src/string.cr:269: instantiating 'String::Builder:Class#build(Int32)'

String::Builder.build(capacity) do |builder|
                ^~~~~

in /usr/share/crystal/src/string.cr:269: instantiating 'String::Builder:Class#build(Int32)'

String::Builder.build(capacity) do |builder|
                ^~~~~

in macro 'render_template' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/amber/src/amber/controller/helpers/render.cr:33, line 2:

1.

  1. Kilt.render("src/views/layouts/application.slang")
    3.
    4.

expanding macro
in macro 'render' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/kilt/src/kilt.cr:22, line 1:

  1. String.build do |__kilt_io__|

    1. Kilt.embed("src/views/layouts/application.slang", "__kilt_io__", )

    2. end

      4.

instantiating 'String:Class#build()'
in macro 'embed' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/kilt/src/kilt.cr:12, line 4:

1.
2.
3.

  1. Slang.embed("src/views/layouts/application.slang", "__kilt_io__", )
    5.
    6.

expanding macro
in macro 'embed' /mnt/c/Users/risharan/Documents/GitHub/diggamber/lib/slang/src/slang/macros.cr:2, line 1:

  1. {{ run("slang/slang/process", "src/views/layouts/application.slang", "__kilt_io__") }}
    2.

macro didn't expand to a valid program, it expanded to:

================================================================================

" 1. __kilt_io__ << "

  1. __kilt_io__ << "
  2. "

4. __kilt_io__ << "

Syntax error in expanded macro: macro_140603294933216:1: expecting '\n' after '\r'

"kilt_io__ << " ^

================================================================================
12:02:59 Watcher | (INFO) Compile time errors detected. Shutting down...
```

I have tried running npm install, sudo shards install, deleting lock files and re-pulling the entire project. My toolset is based on the latest code as of this issue (Amber CLI (amberframework.org) - v0.7.2)

To add, crystal deps build amby is also failing. Not sure is this helps, but my root folder and webapp have different name. My root folder is called diggamer and the app itself is called amby. However, this project ran perfectly on my home pc.

Syntax error in expanded macro: macro_140603294933216:1: expecting '\n' after '\r'

This error seems to be related to https://github.com/crystal-lang/crystal/issues/5831

/cc @obskyr, @straight-shoota, @ysbaddaden @RX14

shards install shouldn't be run with sudo.

@rishavs This is an entirely different problem, please open a new issue for this. But as @faustinoaq stated, it's probably about incorrect line endings. Does your git config automatically force convert line endings or something? (git config core.autocrlf)

Hi @straight-shoota The problem was indeed due to incorrect line ending. My text editor was set to CRLF.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faustinoaq picture faustinoaq  Â·  5Comments

netwarp picture netwarp  Â·  6Comments

sumwatt picture sumwatt  Â·  4Comments

elorest picture elorest  Â·  6Comments

faustinoaq picture faustinoaq  Â·  6Comments