Search code examples
reactjsgoogle-apps-scriptparceljs

ParcelJs Package mislocating 'dict/dict.txt'


I am trying to build a ReactJs Project in Google App Script according to this tutorial here. I encounter an issue with parcel that when I run npm start it throw this error:

Error: ENOENT: no such file or directory, open 'D:\websites\dict\dict.txt'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at makeCompression (D:\websites\#Projects\print-bill\node_modules\lmdb\dist\index.cjs:2047:19)
    at Object.open (D:\websites\#Projects\print-bill\node_modules\lmdb\dist\index.cjs:2057:25)
    at new LMDBCache (D:\websites\#Projects\print-bill\node_modules\@parcel\cache\lib\LMDBCache.js:81:34)
    at resolveOptions (D:\websites\#Projects\print-bill\node_modules\@parcel\core\lib\resolveOptions.js:125:168)
    at async Parcel._init (D:\websites\#Projects\print-bill\node_modules\@parcel\core\lib\Parcel.js:218:27)
    at async Parcel.watch (D:\websites\#Projects\print-bill\node_modules\@parcel\core\lib\Parcel.js:315:7)
    at async run (D:\websites\#Projects\print-bill\node_modules\parcel\lib\cli.js:351:9) {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: 'D:\\websites\\dict\\dict.txt'
}

This is my package.json file:

{
  "name": "print-bill",
  "version": "1.0.0",
  "description": "Simple Web App with Google App Script to generate and print bill",
  "scripts": {
    "g:init": "clasp create --title 'Print Bill' --rootDir ./app-script",
    "g:login": "clasp login",
    "g:logout": "clasp logout",
    "g:clone": "clasp clone {id} --rootDir ./app-script",
    "g:pull": "clasp pull",
    "g:push": "clasp push",
    "g:start": "clasp push --watch",
    "start": "parcel src/index.html --dist-dir ./app-script",
    "build": "parcel build src/index.html --dist-dir ./app-script"
  },
  "keywords": [],
  "author": "TXHENG",
  "license": "ISC",
  "devDependencies": {
    "@types/google-apps-script": "^1.0.57",
    "clasp": "^1.0.0",
    "parcel": "^2.8.3"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.8.2"
  },
  "targets": {
    "main": false
  }
}

Solution

  • I don't know how but it "magically" resolved by changing the package.json file AND moving it to another directory.

    package.json:

    {
      "name": "print-bill",
      "version": "1.0.0",
      "description": "Simple Web App with Google App Script to generate and print bill",
      "source": "src/index.html",
      "destination": "./app-script",
      "scripts": {
        "g:init": "clasp create --title 'Print Bill' --rootDir ./app-script",
        "g:login": "clasp login",
        "g:logout": "clasp logout",
        "g:clone": "clasp clone {id} --rootDir ./app-script",
        "g:pull": "clasp pull",
        "g:push": "clasp push",
        "g:start": "clasp push --watch",
        "start": "parcel",
        "build": "parcel build"
      },
      "keywords": [],
      "author": "TXHENG",
      "license": "ISC",
      "devDependencies": {
        "@types/google-apps-script": "^1.0.57",
        "clasp": "^1.0.0",
        "parcel": "^2.8.3",
        "process": "^0.11.10"
      },
      "dependencies": {
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "react-router-dom": "^6.8.2"
      },
      "targets": {
        "main": false
      }
    }