0

I'm following Notion's instructions to use the Notion API. From the terminal, I have installed the client library ("npm install"). The problem is when I run the script ("node index.js") I get the following error message:

import { Client } from "@notionhq/client"
         ^^^^^^
SyntaxError: The requested module '@notionhq/client' does not provide an export named 'Client'

And for reference my package.json file looks like this:

{
    "name": "notion-example",
    "type": "module",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "dependencies": {
        "@notionhq/client": "^0.1.9"
    }
}

Can someone help me to understand how to resolve this error? I'm still fairly new to coding so any feedback would be appreciated, thanks!

Green
  • 507
  • 10
  • 20

2 Answers2

1

Everything looks right. Since version 0.4.4 is out, you might want to try updating your package.

Here's the command to update the package:

npm update @notionhq/client
Ben Keys
  • 71
  • 1
  • 6
0

I had the same problem which I got around using:

const { Client } = require("@notionhq/client")
matmahnke
  • 432
  • 3
  • 10