Skip to content

Fix to some errors

Axorax edited this page Apr 14, 2023 · 1 revision

• Fix to SyntaxError: Cannot use import statement outside a module

Go to the package.json file for the project that you made. It should look something like this:

{
    "name": "test-project",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "kith": "^1.0.0"
    }
}

Now, add "type": "module" to the package.json file.

{
    "name": "test-project",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "type": "module",
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "kith": "^1.0.0"
    }
}