# Tween.js installation problems

**URL:** <https://discourse.threejs.org/t/tween-js-installation-problems/14341>\
**Category:** Questions\
**Tags:** tweenjs\
**Created:** [April 14, 2020, 9:19pm UTC](https://discourse.threejs.org/t/tween-js-installation-problems/14341 "2020-04-14T21:19:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spatialWarrior](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@spatialWarrior](https://discourse.threejs.org/u/spatialWarrior)\
**Post date:** [April 14, 2020, 9:19pm UTC](https://discourse.threejs.org/t/tween-js-installation-problems/14341/1 "2020-04-14T21:19:37Z")

</div>

Hello everyone,  
I am following the installation instructions from [https://github.com/tweenjs/tween.js/](https://github.com/tweenjs/tween.js/) to include TweenJS in my ThreeJS project.  
My script is: script src=“Lib/tweenjs/tween.umd.js”  
My code is:  
const coords = { x: 0, y: 0 }; // Start at (0, 0)  
const tween = new TWEEN.Tween(coords); // Create a new tween that modifies ‘coords’.  
My error when I try to run this on my website is: _Can’t find variable: TWEEN_  
I’m not sure what I’m missing here, and any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [April 14, 2020, 9:33pm UTC](https://discourse.threejs.org/t/tween-js-installation-problems/14341/2 "2020-04-14T21:33:02Z")

</div>

And what if you use this link `https://cdnjs.cloudflare.com/ajax/libs/tween.js/16.7.0/Tween.js` for the source of `script` tag (taken from the codepen on their github page)?

---

<div class="post-metadata">

**Author:** ![spatialWarrior](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@spatialWarrior](https://discourse.threejs.org/u/spatialWarrior)\
**Post date:** [April 15, 2020, 1:12pm UTC](https://discourse.threejs.org/t/tween-js-installation-problems/14341/3 "2020-04-15T13:12:05Z")

</div>

Thanks for your reply, unfortunately I still see the same error. I also tried running  
`npm install tweenjs` in my project folder, but the error remains. Is it possible I need to include an import in my JS file in addition to this script source in my HTML file?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [April 15, 2020, 3:12pm UTC](https://discourse.threejs.org/t/tween-js-installation-problems/14341/4 "2020-04-15T15:12:36Z")

</div>

> [@spatialWarrior](#):
>
> I also tried running  
> `npm install tweenjs` in my project folder,

When you include `tween.js` with a `<script>` tag from a custom path, then installing npm modules makes no sense.

> [@spatialWarrior](#):
>
> . Is it possible I need to include an import in my JS file in addition to this script source in my HTML file?

No. Please don’t make the common mistake by importing libraries twice. One time as a global script and the other time as an ES6 module.

I’m afraid you have to share your complete code as an editable live example or as a GitHub repo. Use the following fiddle as a code template:

> **[Edit fiddle - JSFiddle - Code Playground](https://jsfiddle.net/ofa7bj8x/)**
>
> Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
