In Elm 0.19 how native works has changed and also how packages are installed and resolved, because of this it might not be possible to install third party native packages ever.
For more information check this issue: https://github.com/gdotdesign/elm-github-install/issues/62
This gem/npm-package allows you to install Elm packages in a decentralized way from Git repositories, this allows:
If you have ruby installed on your machine then you can install it directly from rubygems.org:
gem install elm_install
If you have node.js installed on your machine then you can install it directly from npm:
npm install elm-github-install -g
or with yarn:
yarn global add elm-github-install
If you are experiencing EACCES: permission denied
errors during installation
using NPM then you can try:
sudo npm i -g elm-github-install --unsafe-perm=true --allow-root
There are also dependency free versions available for every release in the releases page.
Once installed elm-install
can be used instead of elm-package
as a
replacement:
elm-package.json
:
{
...
"dependencies": {
"elm-lang/core": "5.0.0 <= v < 6.0.0",
"elm-lang/svg": "2.0.0 <= v < 3.0.0",
"elm-lang/dom": "1.1.1 <= v < 2.0.0"
}
...
}
Command:
$ elm-install
Resolving packages...
▶ Package: https://github.com/elm-lang/core not found in cache, cloning...
▶ Package: https://github.com/elm-lang/svg not found in cache, cloning...
▶ Package: https://github.com/elm-lang/html not found in cache, cloning...
▶ Package: https://github.com/elm-lang/virtual-dom not found in cache, cloning...
▶ Package: https://github.com/elm-lang/dom not found in cache, cloning...
Solving dependencies...
● elm-lang/core - https://github.com/elm-lang/core (5.1.1)
● elm-lang/svg - https://github.com/elm-lang/svg (2.0.0)
● elm-lang/dom - https://github.com/elm-lang/dom (1.1.1)
● elm-lang/html - https://github.com/elm-lang/html (2.0.0)
● elm-lang/virtual-dom - https://github.com/elm-lang/virtual-dom (2.0.4)
Packages configured successfully!
Sources can be defined in the dependency-sources
field in elm-package.json
for any package defined in the dependencies
field.
The source can be defined as:
"elm-lang/core": "git@github.com:someuser/core"
"gdotdesign/elm-install-test": {
"url": "gdotdesign@bitbucket.org:gdotdesign/elm-install-test",
"ref": "master"
}
"elm-lang/dom": "../elm-lang/dom"
If a reference or a path is defined then the version in the dependencies
field is
ignored and the version will be used from the elm-package.json
at that source.
Examples:
...
"dependencies": {
"gdotdesign/elm-install-test": "1.0.0 <= v < 2.0.0",
"elm-lang/core": "5.0.0 <= v < 6.0.0",
"elm-lang/svg": "2.0.0 <= v < 3.0.0",
"elm-lang/dom": "1.1.1 <= v < 2.0.0"
},
"dependency-sources": {
"elm-lang/core": "git@github.com:someuser/core",
"elm-lang/dom": "../elm-lang/dom",
"gdotdesign/elm-install-test": {
"url": "gdotdesign@bitbucket.org:gdotdesign/elm-install-test",
"ref": "master"
}
}
...
Help for the elm-install
command:
NAME:
elm-install
DESCRIPTION:
Install Elm packages from Git repositories.
COMMANDS:
help Display global or [command] help documentation
install Install Elm packages from the elm-package.json file.
GLOBAL OPTIONS:
-h, --help
Display help documentation
-v, --version
Display version information
-t, --trace
Display backtrace when an error occurs
Help for the elm-install install
command.
NAME:
install
SYNOPSIS:
elm-install install
DESCRIPTION:
Install Elm packages from the elm-package.json file.
OPTIONS:
--cache-directory STRING
Specifies where the cache is stored
--skip-update
Skips the update stage of packages
--only-update STRING
Only updates the given package
--verbose
It depends on your use case, but for public repositories in Github or Bitbucket it's not needed.
The following protocols can be used:
Yes private repositories are supported provided you have authentication (for example SSH keys).