There is an issue in my Project and stating 'Cannot find module ' after several attempts and I am trying to install and uninstall the packages simultaneously, the issue is not resolving.
{
"name": "tooling-01-starting-project",
"version": "1.0.0",
"description": "JavaScript The Complete Guide",
"main": "eslint.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"author": "Junaid Jawed",
"license": "ISC",
"devDependencies": {
"eslint": "^7.32.0",
"webpack": "^5.53.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.2.1"
},
"dependencies": {
"grunt": "^1.4.1"
}
}
Below this is my webpack.config.js file coding:-
/* eslint-disable no-undef */
const path = require('path');
module.exports =
{
entry:'./src/app.js',
output:
{
filename:'app.js',
path:path.resolve(__dirname,'assets','scripts')
}
};
const path2 = require('path');
module.exports =
{
entry:'./node_modules/webpack/bin/webpack.js',
output:
{
filename:'webpack.js',
path2:path2.resolve(__dirname,'webpack','bin')
}
};
Also above I have attached an screenshot of my error in npm command prompt:-
Can somebody tell me what is the problem of this issue? I think it doesn't found the file location where my webpack.js file is located.
I've been stuck with that kind of issues for times in the past.
One thing that it could be, is about the project location. Here it is said that's in E:\
, try to relocate it in C:\Users\YourUser\Documents\MyProject
and do the following:
Run npm i
command, and start the solution. If it doesn't work, could be an issue regarding the version of node that's installed in your computer...