Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on : json-server --watch db.json #1518

Open
monupurohit opened this issue Feb 18, 2024 · 1 comment
Open

Error on : json-server --watch db.json #1518

monupurohit opened this issue Feb 18, 2024 · 1 comment

Comments

@monupurohit
Copy link

json-server --watch db.json
C:\Users\purohit\AppData\Roaming\npm\node_modules\json-server\lib\bin.js:2
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
^^^^^^

SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3

@kaz1ngton
Copy link

Hi @monupurohit
As described in package.json, you should be using node version >=18.3. Check the current node version and update it if necessary 😉

The node:fs module was released in node@16.*, and before that the fs module was used instead. My guess is that you just have the wrong version of node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants