Giter Club home page Giter Club logo

elm-0.19-workshop's Introduction

This workshop, as well as the slides that go with it (linked below), are all licensed under a Creative Commons Attribution 4.0 International License. The server/ directories use moleculer-node-realworld-example, which has its own license. The JavaScript interop example uses localForage, which is (c) 2013-2017 Mozilla, under the Apache License 2.0. The rest of the code is a variation on elm-spa-example, an MIT-licensed implementation of the realworld front-end. Many thanks to the authors of these projects!

Getting Started

  1. Install Node.js 7.0.0 or higher

  2. Add a plugin for your editor of choice: Atom, Sublime Text, VS Code, Light Table, Vim, Emacs, Brackets

  3. Not required, but highly recommended: enable "elm-format on save" in your editor.

  4. Run the following command to install all the other Elm tools:

Note: Make sure not to run this command with sudo! If it gives you an EACCESS error, apply this fix and then re-run the command (still without sudo).

npm install -g elm elm-test elm-format
  1. Clone this repository

Run this at the terminal:

git clone https://github.com/rtfeldman/elm-0.19-workshop.git
cd elm-0.19-workshop
  1. Continue with either the intro or advanced instructions, depending on which workshop you're doing!

Video Course of this Workshop

I recorded full-length videos for Frontend Masters, in which I teach both of these workshops start to finish:

elm-0.19-workshop's People

Contributors

1marc avatar falonofthetower avatar mkohler avatar noahzgordon avatar rtfeldman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elm-0.19-workshop's Issues

Elm version mismatch

I started the Elm Introduction v2 today, following the "Getting Started" instructions:

david ~ $ npm install -g elm [email protected] elm-format
npm WARN deprecated [email protected]: Way too old
/home/david/.nvm/versions/node/v8.2.1/bin/elm -> /home/david/.nvm/versions/node/v8.2.1/lib/node_modules/elm/bin/elm
/home/david/.nvm/versions/node/v8.2.1/bin/elm-format -> /home/david/.nvm/versions/node/v8.2.1/lib/node_modules/elm-format/bin/elm-format
/home/david/.nvm/versions/node/v8.2.1/bin/elm-test -> /home/david/.nvm/versions/node/v8.2.1/lib/node_modules/elm-test/bin/elm-test
> [email protected] install /home/david/.nvm/versions/node/v8.2.1/lib/node_modules/elm
> node install.js
--------------------------------------------------------------------------------
Downloading Elm 0.19.1 from GitHub.

Then at the Introduction to Elm Workshop at the Build the Elm UI I got:

david workspaceUI $ cd elm-0.19-workshop/
david (master *) elm-0.19-workshop $ cd intro/server
david (master *) server $ elm make src/Main.elm --output=../server/public/elm.js
Dependencies ready!         
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

david (master *) server $ 

Elm package install error - no such version

Seems to be an issue witht he version of telm-test specified in the instructions e.g.

± % npm install -g elm [email protected] elm-format                                                        !5038
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected]
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tcross8/.npm/_logs/2018-10-23T01_41_06_040Z-debug.log

Trying to run server: "cannot enable cancellation after promises are in use"

I'm on MacOS 10.14.6. Tried with Node 8.15.0, 12.13.0 and 13.0.1. I keep getting the same error:

> [email protected] start /Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server
> moleculer-runner services

cannot enable cancellation after promises are in use Error: cannot enable cancellation after promises are in use
    at Service.created (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer-web/src/index.js:80:16)
    at /Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/src/service.js:174:41
    at Array.forEach (<anonymous>)
    at Service._init (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/src/service.js:174:24)
    at Service.parseServiceSchema (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/src/service.js:148:8)
    at new Service (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/src/service.js:57:9)
    at ServiceBroker.createService (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/src/service-broker.js:636:14)
    at ServiceBroker.loadService (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/src/service-broker.js:563:15)
    at /Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/bin/moleculer-runner.js:352:44
    at Array.forEach (<anonymous>)
    at loadServices (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/bin/moleculer-runner.js:352:24)
    at startBroker (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/bin/moleculer-runner.js:422:2)
From previous event:
    at run (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/bin/moleculer-runner.js:439:4)
    at /Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/bin/moleculer-runner.js:453:10
    at processImmediate (internal/timers.js:439:21)
From previous event:
    at Object.<anonymous> (/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/moleculer/bin/moleculer-runner.js:448:3)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `moleculer-runner services`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gemerson/.npm/_logs/2019-11-05T00_53_09_423Z-debug.log

Contents of log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/gemerson/.nvm/versions/node/v12.13.0/bin/node',
1 verbose cli   '/Users/gemerson/.nvm/versions/node/v12.13.0/bin/npm',
1 verbose cli   'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /Users/gemerson/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server/node_modules/.bin:/Users/gemerson/.nvm/versions/node/v12.13.0/bin:/Users/gemerson/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle [email protected]~start: CWD: /Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server
10 silly lifecycle [email protected]~start: Args: [ '-c', 'moleculer-runner services' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `moleculer-runner services`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/gemerson/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:210:5)
13 verbose stack     at ChildProcess.<anonymous> (/Users/gemerson/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:210:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/gemerson/Projects/elm.frontendmasters/elm-0.19-workshop/intro/server
16 verbose Darwin 18.7.0
17 verbose argv "/Users/gemerson/.nvm/versions/node/v12.13.0/bin/node" "/Users/gemerson/.nvm/versions/node/v12.13.0/bin/npm" "start"
18 verbose node v12.13.0
19 verbose npm  v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `moleculer-runner services`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Trying to login returns error

{
  "name": "MoleculerError",
  "message": "No callback function was given.",
  "code": 500
}

Status code is 500 on /api/users/login

Am running a clone of this repository (from about a few days ago) in a vscode dev container for elm (which includes nodejs (node v12.19.0, npm 6.14.8).

Here is my .devcontainer folder:

{
	"name": "Elm (Community)",
	"dockerFile": "Dockerfile",
	"settings": {
		"terminal.integrated.shell.linux": "/bin/bash"
	},
	"extensions": [
		"Elmtooling.elm-ls-vscode",
		"tobermory.es6-string-html",
		"bashmish.es6-string-css",
		"gruntfuggly.todo-tree"
	],
	"forwardPorts": [
		8000,
		3000
	],
	"remoteUser": "node",
}
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:12

# Configuring Elm version
ARG ELM_VERSION=latest-0.19.1
ARG ELM_TEST_VERSION=latest-0.19.1
ARG ELM_FORMAT_VERSION=latest-0.19.1

# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in
# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user.
ARG USERNAME=node
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Install elm, elm-test and elm-format
RUN export DEBIAN_FRONTEND=noninteractive \
    && sudo -u ${USERNAME} npm install --global \
    elm@${ELM_VERSION} \
    elm-test@${ELM_TEST_VERSION} \
    elm-format@${ELM_FORMAT_VERSION} \
    #
    # [Optional] Update UID/GID if needed
    && if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
        groupmod --gid $USER_GID $USERNAME \
        && usermod --uid $USER_UID --gid $USER_GID $USERNAME \
        && chown -R $USER_UID:$USER_GID /home/$USERNAME; \
    fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.