Error Latihan JSON

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #203484
    riyanda.c.sinambela
    Participant

      index.js:
      const fs = require(‘fs’);

      let data = fs.readFileSync(‘./data.json’, ‘utf-8’)

      console.log(data)

      data.json
      [
      {
      “id”: 1,
      “name”: “Limit”,
      “score”: 95
      },
      {
      “id”: 2,
      “name”: “Skiler”,
      “score”: 90
      }
      ]

      error message:
      node:internal/fs/utils:351
      throw err;
      ^

      Error: ENOENT: no such file or directory, open ‘\\?\D:\Tutorial\data.json’
      at readFileSyncUtf8 (node:internal/fs/read/utf8:20:3)
      at Object.readFileSync (node:fs:467:12)
      at Object.<anonymous> (d:\Tutorial\Belajar-menjadi-fullstack-web-developer\Intermediate\4. JavaScript Object Notation\index.js:3:15)
      at Module._compile (node:internal/modules/cjs/loader:1233:14)
      at Module._load (node:internal/modules/cjs/loader:938:12)
      at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
      at node:internal/main/run_main_module:23:47 {
      errno: -4058,
      syscall: ‘open’,
      code: ‘ENOENT’,
      path: ‘\\\\?\\D:\\Tutorial\\data.json’
      }

      #203493
      riyanda.c.sinambela
      Participant

        udah kesolve

        #203549
        Coach Vincent
        Moderator

          baik terima kasih

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.
        Shopping cart0
        There are no products in the cart!
        Continue shopping