javascriptnode.jstypescriptparcel

Parcel Error: Cannot find module './artifacts/index.win32-ia32-msvc.node'


I'm trying to use Parcel the first time. When I run: npx parcel .\app\index.html, I get an error:

Error: Cannot find module './artifacts/index.win32-ia32-msvc.node'
Require stack:
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\source-map\parcel_sourcemap_node\index.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\source-map\dist\node.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\utils\lib\index.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\core\lib\public\Config.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\core\lib\utils.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\core\lib\public\Environment.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\core\lib\public\Asset.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\core\lib\Parcel.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\core\lib\index.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\parcel\lib\cli.js
- C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\parcel\lib\bin.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at Object.<anonymous> (C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\@parcel\source-map\parcel_sourcemap_node\index.js:15:18)
    at Module._compile (C:\Users\Lenovo\Desktop\first-typescript-project\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\source-map\\parcel_sourcemap_node\\index.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\source-map\\dist\\node.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\utils\\lib\\index.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\core\\lib\\public\\Config.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\core\\lib\\utils.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\core\\lib\\public\\Environment.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\core\\lib\\public\\Asset.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\core\\lib\\Parcel.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\@parcel\\core\\lib\\index.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\parcel\\lib\\cli.js',
    'C:\\Users\\Lenovo\\Desktop\\first-typescript-project\\node_modules\\parcel\\lib\\bin.js'
  ]
}

Here is my project folder:

enter image description here

Here is my package.json file:

{
  "name": "first-typescript-project",
  "version": "1.0.0",
  "description": "Making some experiments",
  "main": "app/index.html",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "cssnano": "^6.0.0",
    "parcel": "^2.8.3",
    "postcss": "^8.4.21",
    "typescript": "^4.9.5"
  }
}

I tried all options that I have found in the internet:


Solution

  • I just found the solution to this problem after suffering from it for 3 days... you can install the latest version of node which is currently 20.0, then delete your node_modules and run npm i in your terminal and everything will be fine. Good luck!