internalBinding('errors').triggerUncaughtException(

2.7k views Asked by At

I am facing the issue during installation of chalk module with node version 14 using command npm install chalk and facing this issue could not find any solution.

package.json file

  "name": "notes-app",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "jayant",
  "license": "ISC",
  "dependencies": {
    "chalk": "^5.0.0"
  },
  "type": "module"
}

app.js file

import chalk from 'chalk';

console.log(chalk.blue('Hello world!'));

Got this error while running app.js with node version 14

    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'C:\previous data\Jayant\Programs\node-tutorials\notes-app\node_modules\chalk\source\node_modules\' imported from C:\previous data\Jayant\Programs\node-tutorials\notes-app\node_modules\chalk\source\index.js
    at packageMainResolve (internal/modules/esm/resolve.js:458:9)
    at packageResolve (internal/modules/esm/resolve.js:601:14)
    at moduleResolve (internal/modules/esm/resolve.js:646:14)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:692:13)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:42:40)
    at link (internal/modules/esm/module_job.js:41:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}
0

There are 0 answers