# \`The module Bytes is an alias for module Stdlib\_\_Bytes, which is missing\` error in OCaml 4.14

**URL:** <https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821>\
**Category:** Learning\
**Created:** [March 28, 2023, 10:23pm UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821 "2023-03-28T22:23:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![aqjune](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/aqjune/32/4090_2.png) [@aqjune](https://discuss.ocaml.org/u/aqjune)\
**Post date:** [March 28, 2023, 10:23pm UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/1 "2023-03-28T22:23:01Z")

</div>

Hi,

I am trying to run an .ml file that uses the Bytes module which seems to have existed in the past (OCaml 4.05) on REPL.

However, if I run it on OCaml 4.14 REPL, I am seeing the following error:

```auto
The module Bytes is an alias for module Stdlib__Bytes, which is missing

```

Could anyone provide a hint to fix or solution of this error?

Thanks,

---

<div class="post-metadata">

**Author:** ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Post date:** [March 29, 2023, 1:25am UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/2 "2023-03-29T01:25:30Z")

</div>

How did you install OCaml? Did you use opam? If so, what is the output of `opam switch`? For example, on my machine,

```auto
$ opam switch
# switch compiler description
   5.0.0 ocaml-base-compiler.5.0.0 5.0.0
→ default ocaml.4.14.1 default

```

Which implies the standard library files should be in the correct directory:

```auto
$ ls ~/.opam/default/lib/ocaml/stdlib__Bytes*
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__Bytes.cmi
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__Bytes.cmt
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__Bytes.cmti
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__Bytes.cmx
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__BytesLabels.cmi
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__BytesLabels.cmt
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__BytesLabels.cmti
/Users/yawarquadiramin/.opam/default/lib/ocaml/stdlib__BytesLabels.cmx

```

Are your files installed correctly?

---

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [March 29, 2023, 8:46am UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/3 "2023-03-29T08:46:54Z")

</div>

This is a weird error that should not happen. The `Bytes` module still exists. Did you check that your environment is consistent and that you don’t have a module named `Stdlib`? Do you happen to use an `.ocamlinit` file?

---

<div class="post-metadata">

**Author:** ![aqjune](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/aqjune/32/4090_2.png) [@aqjune](https://discuss.ocaml.org/u/aqjune)\
**Post date:** [March 29, 2023, 2:34pm UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/4 "2023-03-29T14:34:23Z")

</div>

No, I didn’t use it at `.ocamlinit`. Instead, the `.ml` script that invokes `Bytes.get` is loaded by `Toploop.use_file` on REPL.  
One interesting observation is that, before loading the `.ml` file, if I simply typecheck `Bytes.get` on REPL and load the `.ml` file using `Toploop.use_file` on REPL then it works well.  
I will reduce this code so that a reproducible code snippet can be shared.

---

<div class="post-metadata">

**Author:** ![aqjune](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/aqjune/32/4090_2.png) [@aqjune](https://discuss.ocaml.org/u/aqjune)\
**Post date:** [March 29, 2023, 2:36pm UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/5 "2023-03-29T14:36:20Z")

</div>

Yes, I use opam, but the opam is locally configured (`opam env` prints the directory that is specific to this project).  
Interestingly I can find the `./lib/ocaml/stdlib__Bytes.*` from the local opam directory as well.

---

<div class="post-metadata">

**Author:** ![SpiceGuid](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/spiceguid/32/2752_2.png) [@SpiceGuid](https://discuss.ocaml.org/u/SpiceGuid)\
**Post date:** [April 6, 2023, 1:57pm UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/6 "2023-04-06T13:57:46Z")

</div>

OCaml 4.14.0 or OCaml 4.14.1 ?

Test `#show_module Bytes;;`  
and `#show_module Stdlib.Bytes;;`

---

<div class="post-metadata">

**Author:** ![aqjune](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/aqjune/32/4090_2.png) [@aqjune](https://discuss.ocaml.org/u/aqjune)\
**Post date:** [May 26, 2023, 9:20pm UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/7 "2023-05-26T21:20:59Z")

</div>

Hi all, I managed to reduce the program into its minimal form! It consists of these four statements on OCaml REPL 4.14.0:

```auto
my_desktop: ~/ $ ocaml
OCaml version 4.14.0
Enter #help;; for help.

# #directory "+compiler-libs";;
# #load "ocamlcommon.cma";;
# Env.fold_modules (fun s p md () -> ()) (Some (Longident.Lident "Bytes")) !Toploop.toplevel_env ();;
- : unit = ()
# Bytes.get;;
Error: The module Bytes is an alias for module Stdlib__Bytes, which is missing

```

`opam list` shows the package versions as follows:

```auto
# Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp-streams 5.0.1 The Stream and Genlex libraries for use with Camlp4 and Camlp5
camlp5 8.00.03 pinned to version 8.00.03
conf-perl 2 Virtual package relying on perl
conf-perl-ipc-system-simple 3 Virtual package relying on perl's IPC::System::Simple
conf-perl-string-shellquote 3 Virtual package relying on perl's String::ShellQuote
dune 3.7.1 Fast, portable, and opinionated build system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.14.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.14.0 Official release 4.14.0
ocaml-config 2 OCaml Switch Configuration
ocaml-options-vanilla 1 Ensure that OCaml is compiled with no special options enabled
ocamlfind 1.9.6 A library manager for OCaml

```

---

<div class="post-metadata">

**Author:** ![aqjune](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/aqjune/32/4090_2.png) [@aqjune](https://discuss.ocaml.org/u/aqjune)\
**Post date:** [May 27, 2023, 6:14am UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/8 "2023-05-27T06:14:58Z")

</div>

I reposted this error at ocaml repo’s GitHub Issue here: [`The module Bytes is an alias for module Stdlib__Bytes, which is missing` error in OCaml 4.14 · Issue #12271 · ocaml/ocaml · GitHub](https://github.com/ocaml/ocaml/issues/12271)

---

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [May 27, 2023, 8:20am UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/9 "2023-05-27T08:20:26Z")

</div>

Note that the short answer for using `compiler-libs` within the REPL is to use `utop-full` (or another not expunged toplevel). Loading `compiler-libs` a second time in the REPL create two separate instances of the compiler-libs modules which invariably leads to issues.

---

<div class="post-metadata">

**Author:** ![aqjune](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/aqjune/32/4090_2.png) [@aqjune](https://discuss.ocaml.org/u/aqjune)\
**Post date:** [May 30, 2023, 3:38pm UTC](https://discuss.ocaml.org/t/the-module-bytes-is-an-alias-for-module-stdlib-bytes-which-is-missing-error-in-ocaml-4-14/11821/10 "2023-05-30T15:38:59Z")

</div>

For anyone interested in this topic: the Github issue also contains some thread about ocamlmktop.
