Rinkusu – 04-39 Jan 29
Even after "npm init", "npm i fs" and adding "type": "module" I keep getting "Cannot use import statement outside a module". Any idea please ?
32 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
require is not defined
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I don't know if I did it right. It is just a JS project (dir with css, html and js files) that I tried to turn into node.js so I can use fs
with chrome (live server extension of vs code)
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
you mean node packages ? I did a lot of React and never had any issue like this
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
how do I do that ?
(I just want to modify a local json file)
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
require is not defined
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
v14.17.0
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
done
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
no I meant already done
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Cannot use import statement outside a module
I'm retrying with the line in package.json
got
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok, I got my data back
but how do I run the html page and the file with node at the "same time" or something like that
You said I don't neet to install it, u meant the npm i fs ?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yeah I know, but I want to modify it
from the html page
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i used xhr
ok I got it now, sry you already told me
I thought node was a solution
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok thx a lot for your time
even if I don't think I'll make a back for this 😅
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/936842902624157708