# THREE is not defined

**URL:** <https://discourse.threejs.org/t/three-is-not-defined/7941>\
**Category:** Questions\
**Tags:** getting-started\
**Created:** [June 5, 2019, 5:05am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941 "2019-06-05T05:05:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaron\_m](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yaron_m/32/5831_2.png) [@Yaron\_m](https://discourse.threejs.org/u/Yaron_m)\
**Post date:** [June 5, 2019, 5:05am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/1 "2019-06-05T05:05:29Z")

</div>

I always get the error THREE is not defined, I have not found any solution yet.  
I’ve attached the three.js library in the script tag. I don’t know what seems to be the problem.

I’ve tried

> ```
> loadScripts(["js/vendor/three/three.js"], function() {
> console.log( THREE );
> });
> 
> ```

screenshots:

 ![unknowsn](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/5/5b1f2e87a4587919bb0f51624d9d674825aef5a6.png) ![unknown](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/d/d50f4b8f76e5e5c02633c24036c98d5fdbbc9a92.png)

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [June 5, 2019, 5:58am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/2 "2019-06-05T05:58:46Z")

</div>

> [@Yaron\_m](#):
>
> loadScripts

Where does this function come from?

Please include the entire code that reproduces your problem, copying a tiny snippet is not enough to help you.

---

<div class="post-metadata">

**Author:** ![Yaron\_m](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yaron_m/32/5831_2.png) [@Yaron\_m](https://discourse.threejs.org/u/Yaron_m)\
**Post date:** [June 5, 2019, 6:03am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/3 "2019-06-05T06:03:33Z")

</div>

Thank you for u reply, one moment.

loadScripts =\> [THREE is not defined in .js file](https://discourse.threejs.org/t/three-is-not-defined-in-js-file/3870)

Im working with this tutorial: [https://discoverthreejs.com/book/1-first-steps/6-shapes-transformations/](https://discoverthreejs.com/book/1-first-steps/6-shapes-transformations/)

Folder:

> **[WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free](https://wetransfer.com/downloads/49325be5b5f5206fa80f41fd843fd9df20190605060321/cbff28)**
>
> WeTransfer is the simplest way to send your files around the world

I fix’ed it:  
I had: (color with small c)

> scene.background = new THREE.clolor( ‘skyblue’ )  
> fix:  
> scene.background = new THREE.Clolor( ‘skyblue’ )

But why is there such a big impact? I mean THREE is still defined right?

---

<div class="post-metadata">

**Author:** ![Yaron\_m](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yaron_m/32/5831_2.png) [@Yaron\_m](https://discourse.threejs.org/u/Yaron_m)\
**Post date:** [June 5, 2019, 6:12am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/4 "2019-06-05T06:12:07Z")

</div>

Holy “”"" u are the creator of this book 😯

U are awesome I love it, can’t wait to see the full release 😉 I started Coding (JavaScript) last week and ur book really helped me Thx \<3

Question: In the Chapter (GETTING CREATIVE WITH SHAPES AND TRANSFORMATIONS) should I edit the file I already have or should I create a completely new document? Like I did now?

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [June 5, 2019, 7:55am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/5 "2019-06-05T07:55:54Z")

</div>

> Holy “”“” u are the creator of this book 😯

Haha! Thank you 😁

OK, your code is generally fine, but there are lots of misspellings:

1. `styles` folder should be ‘styles’ folder.
2. `PerscpectiveCamera` → `PerspectiveCamera`
3. `faltShading` → `flatShading`

I know this because I use [VSCode](https://code.visualstudio.com/) as an editor, and I’ve installed a [spell checker extension](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) so that those words were immediately highlighted.

It won’t help you if you forget a capital letter though, like `color` → `Color`. Then you get an error.

> should I edit the file I already have or should I create a completely new document? Like I did now?

You can create a new file like you did now, that’s fine.

However, for the next chapter that won’t work, since you need to load models. Then you need to run a HTTP server. I use [http-server](https://www.npmjs.com/package/http-server), and there’s more info about this on the [How to run things locally](https://threejs.org/docs/#manual/en/introduction/How-to-run-things-locally) page.

---

<div class="post-metadata">

**Author:** ![Yaron\_m](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yaron_m/32/5831_2.png) [@Yaron\_m](https://discourse.threejs.org/u/Yaron_m)\
**Post date:** [June 5, 2019, 9:08am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/6 "2019-06-05T09:08:42Z")

</div>

That’s awesome, thank you for ur recommendation, I already downloaded VScode and the spell checker, that’s awesome! My spelling is not really good so this is perfect for me. I also corrected my spellings so I think I’m good to go. 😌

First I was wondering why I can’t see the blue background, do I need a render engine for the background?

instead of using an HTTP server could I change the origin policy on my browser alternatively?

u mentioned some forums like this one here, is there a way to find u on discord? I am already in some really pleasant forums but I would really appreciate a Mentor \*)

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [June 5, 2019, 10:57am UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/7 "2019-06-05T10:57:25Z")

</div>

> [@Yaron\_m](#):
>
> instead of using an HTTP server could I change the origin policy on my browser alternatively?

There are ways of configuring your browser to load it, but I’m not going to recommend any because it breaks the security on your computer and then people could steal your info. It’s best to use a HTTP server.

> First I was wondering why I can’t see the blue background, do I need a render engine for the background?

The script you sent me only has about half as many lines as the example in the book. Try adding the rest.

---

<div class="post-metadata">

**Author:** ![Yaron\_m](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yaron_m/32/5831_2.png) [@Yaron\_m](https://discourse.threejs.org/u/Yaron_m)\
**Post date:** [June 5, 2019, 12:19pm UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/8 "2019-06-05T12:19:26Z")

</div>

I finished the script:) and I didn’t saw any information about the render in the chapter. do I need to add one on my own?

> **[Train/.vscode/settings.json and 7 more files](https://wetransfer.com/downloads/89f1b4ec9f597e626853a0413fd96c5b20190605125543/a18e68)**
>
> 8 files sent via WeTransfer, the simplest way to send your files around the world

---

<div class="post-metadata">

**Author:** ![pailhead](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pailhead/32/85_2.png) [@pailhead](https://discourse.threejs.org/u/pailhead)\
**Post date:** [June 6, 2019, 6:43pm UTC](https://discourse.threejs.org/t/three-is-not-defined/7941/9 "2019-06-06T18:43:20Z")

</div>

Try using `THREE.Color` instead of `THREE.Clolor`. Cloror is a type of cleaner, like clorox.
