dragonman225 / notablog

Tell stories of your work with Notion

Home Page:https://dragonman225.js.org/notablog.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`public/index.html` preview issue for Node.js < v14

JanakyMurthy opened this issue · comments

I did a clean install from the latest notablog repo and tried generating my blog. I got the following error when I tried to view public/index.html. Why could this have happened?
image

Did you clone the latest notablog-starter (https://github.com/dragonman225/notablog-starter) but not upgrade notablog (e.g. do npm i -g notablog)?

Did you clone the latest notablog-starter (https://github.com/dragonman225/notablog-starter) but not upgrade notablog (e.g. do npm i -g notablog)?

I could not remember what I did. So I tried this

$npm uninstall -g notablog --save
$npm i -g notablog 
$git clone https://github.com/dragonman225/notablog-starter.git
$cd notablog-starter
# changed the url in config.json after this
$notablog generate .

I got the following error

/usr/local/lib/node_modules/notablog/dist/index.js:482
            tags: record.propertyCellMap.get(propertyAccessMap.get('tags'))?.value || [],
                                                                            ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:1053:16)
    at Module._compile (internal/modules/cjs/loader.js:1101:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/notablog/bin/cli.js:6:31)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    ```

Ah, it's a compatibility issue. Looks like Optional chaining (?.) is not available in the version of Node.js on your computer.
If you don't mind using newer version of Node.js, you can upgrade it to 14.0.0 or higher and you'll be able to run notablog. Or you can wait for me to look into how to modify the tsconfig to get it working on older version of Node.js.

Ah, it's a compatibility issue. Looks like Optional chaining (?.) is not available in the version of Node.js on your computer.
If you don't mind using newer version of Node.js, you can upgrade it to 14.0.0 or higher and you'll be able to run notablog. Or you can wait for me to look into how to modify the tsconfig to get it working on older version of Node.js.

Thanks a lot!! upgrading fixed the issue.