'Cannot import Three.js into my project: server returns with an error of 404 (three.js)
I was checking my portfolio, which was working fine a few weeks ago, and i found out that my three.js model isn't showing anymore (I haven't modified anything since it was working fine.), and when I checked the errors in the console, it gave me this error: Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../"..
I was importing three.js in a main.js file like this:
import * as THREE from 'https://cdn.skypack.dev/three', so I changed the import to: import * as THREE from '../node_modules/three/build/three.js', but now it returns an error of 404. what should I do?
This is my file structure:
Solution 1:[1]
The proper way to install three.js is described here:
https://threejs.org/docs/#manual/en/introduction/Installation
should be like so:
import * as THREE from 'three';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | André Kelling |

