Error: can't find file 'sanitize'

I run shards install on my project (which use source_typer as development dependencies failed

 ╰──➤ $ shards install
Resolving dependencies
Fetching https://github.com/j8r/tail.cr.git
Fetching https://github.com/crystal-ameba/ameba.git
Fetching https://github.com/vici37/cr-source-typer.git
Fetching https://github.com/petoem/inotify.cr.git
Fetching https://github.com/i3oris/reply.git
Fetching https://github.com/icyleaf/markd.git
Installing inotify (1.2.0 at 77b9c80)
Installing tail (0.3.1)
Installing ameba (1.6.4)
Postinstall of ameba: shards build -Dpreview_mt
Installing markd (0.5.0)
Installing reply (0.4.0)
Installing source-typer (0.3.5 at 022b9d3)
Postinstall of source-typer: shards build --without-development
Failed postinstall of source-typer on shards build --without-development:
CRYSTAL_WORKERS=
args=   --without-development
I: Resolving dependencies
I: Fetching https://github.com/icyleaf/markd.git
I: Fetching https://github.com/i3oris/reply.git
I: Using markd (0.5.0)
I: Using reply (0.4.0)
I: Writing shard.lock
I: Building: typer
E: Error target typer failed to compile:
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'macro_140407006690976'

Code in /home/zw963/Crystal/share/crystal/src/compiler/crystal/tools/doc/markd_doc_renderer.cr:1:1

 1 | {% if !flag?(:without_libxml2) %}
     ^
Called macro defined in /home/zw963/Crystal/share/crystal/src/compiler/crystal/tools/doc/markd_doc_renderer.cr:1:1

 1 | {% if !flag?(:without_libxml2) %}

Which expanded to:

   1 |
 > 2 |   require "sanitize"
         ^
Error: can't find file 'sanitize'

If you're trying to require a shard:
- Did you remember to run `shards install`?
- Did you make sure you're running the compiler in the same directory as your shard.yml?

I notice sanitize is a shards in the crystal source code, but after I installed my self-compiled crystal compiler.

  1. not install(copy) following folder into dest install folder
    ╰──➤ $ ls lib/
    markd reply sanitize
  2. crystal env not include the lib folder

Could the command I ran during installation be wrong?

FLAGS=-Dpreview_mt make interpreter=1 stats=1 release=1

following is the installed files:(no lib)

```
tmp
└── usr
└── local
├── bin
│ └── crystal
└── share
├── bash-completion
├── crystal
├── fish
├── licenses
├── man
└── zsh
```

Or do I need to do some copying and setup myself?

Related postinstall fails due to unmet dependency · Issue #3 · Vici37/cr-source-typer · GitHub

1 Like

Whoops! Thanks, will look into this tomorrow :grimacing:

On the plus side, I’m glad people are using this!

Hi, How’s the integration into Crystal’s process going now?

typer is already much less bug than crystal i, I consider we can it into tool as EXPERIMENTAL too.

Updated the master branch.

Hi, How’s the integration into Crystal’s process going now?

Unchanged from about a year ago :sweat_smile: I went through a good chunk of the crystal standard library and most of the changes were accepted. Some regressions were found that needed to be reverted (types other’s were using with previously untyped methods that weren’t represented in the specs or crystal compiler itself). Then life got busy in the fall → now timeframe.

A lot of good learnings came from that exercise and I had created this PR so that source typing could ignore :nodoc: annotated methods and classes as an option. Thanks @straight-shoota and @ysbaddaden for your patience and help with this tool so far! I’ll be getting to those PR comments…. soon.

2 Likes