JuMP - with_optimizer method not working

Trying to run this very basic code as is from JuMP / examples in side Jupyter Notebook, but getting this “UndefVarError: with_optimizer not defined” error. Any idea what is missing or going wrong ?

using JuMP, GLPK, LinearAlgebra

Maximization problem

solver = GLPK.Optimizer
m = Model(with_optimizer(solver))

@variable(m, x[1:5], Bin)

profit = [ 5, 3, 2, 7, 4 ]
weight = [ 2, 8, 4, 2, 5 ]
capacity = 10

############################################
UndefVarError: with_optimizer not defined

Stacktrace:
[1] top-level scope at In[4]:4

##########################################

Thanks.

What is the original link to the example?

Check that you are using JuMP v0.19 (which is still in alpha-release) or JuMP master, with_optimizer is the new syntax for it and is not available in JuMP v0.18.