2021年3月13日星期六

I keep getting the error:require is not defined

<!DOCTYPE html>  <html lang="it">    <title>Gamefic</title>    <head>           <link rel="stylesheet" href="style.css" type="text/css" />      <meta charset="UTF-8" />      <meta http-equiv="X-UA-Compatible" content="IE=edge" />      <meta name="viewport" content="width=device-width, initial-scale=1.0" />      <title>Document</title>    </head>    <body>      <h1><strong><em>TEST</h1></em></strong>            <input id= "text" type="text" value="" placeholder="Inserisci la tua idea qui"> <br> <br>      <input id="button" type="button" onclick="c()" value = "premi questo pulsante">      <button onclick="BB()">Test</button>     <p id="b"></p>    </body>    <script src="script.js"></script>    <script>   function BB(){       var fs = require('fs')       fs.appendFile('IDEE.txt', 'Hello!', function(err, data){          console.log(data)      })}        </script>  </html>  

If sombody know how to fix this problem or how to implement fs in html code i would appreciate it very much. I have tried almost everything. Thanks

https://stackoverflow.com/questions/66620102/i-keep-getting-the-errorrequire-is-not-defined March 14, 2021 at 09:05AM

没有评论:

发表评论