Skip to content

ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Idessign' #6858

@idessignflo

Description

@idessignflo

Do you want to request a feature or report a bug?
yes it is bug

What is the current behavior?

C:\Idessign>webpack
Hash: 18bc2fd105d4883da519
Version: webpack 4.2.0
Time: 108ms
Built at: 2018-3-24 18:56:38

WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Idessign'

my webpack.config.js
const webpack = require('webpack'),
path = require('path'),

const APP_DIR = path.resolve(__dirname, "./src/");
const browserConfig ={
entry :

  APP_DIR + 'client/index.js',

output : {
path : BUILD_DIR,
filename : "[name] bundle.js",
publicPath:BUILD_DIR,
},
}
always nothing
If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
the compilation
If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
Version: webpack 4.2.0
windows 8.1profetionnel

Activity

matheus1lva

matheus1lva commented on Mar 24, 2018

@matheus1lva
Member

Could you create a sample repository with a small example on how to reproduce this problem? Configuration seems fine. If you are having problems with configuration goes to stackoverflow and open a question there because this does not seems to be a problem with webpack.

montogeek

montogeek commented on Mar 25, 2018

@montogeek
Member

src folder exists? You are using wrong paths in your configuration.

zycjiayou

zycjiayou commented on Mar 26, 2018

@zycjiayou

I have the same question, this is a bug.
Version: webpack 4.2.0
windows 8.1profetionnel

ooflorent

ooflorent commented on Mar 26, 2018

@ooflorent
Member

It looks like some paths are misconfigured. I encourage you to ask your question on StackOverflow instead. We try to use the issue tracker for bug reports and feature requests, as well as some discussions, but this appears to be a very localized question.

I’m closing for these reasons.

peacecup

peacecup commented on Mar 28, 2018

@peacecup

I have the same problem.It hasn't solved the problem yet, do you have any idea?

ooflorent

ooflorent commented on Mar 28, 2018

@ooflorent
Member

@peacecup please open a new issue with the reproduction code in a github repository

idessignflo

idessignflo commented on Mar 28, 2018

@idessignflo
Author

the problem comes with webpack@4.3.0 the configuration it is correct
look my webpack.config.js
const webpack = require('webpack'),
path = require('path'),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
nodeExternals = require('webpack-node-externals'),
srcPath = path.resolve(__dirname, "./src/"),
distPath = path.resolve(__dirname, './src/build/');
const HTMLPlugin = require('html-webpack-plugin');

const BUILD_DIR = path.resolve(__dirname , "./src/build/");
// var APP_DIR = path.resolve(__dirname, "src/app");
const APP_DIR = path.resolve(__dirname, "./src/");
const IMG_DIR = path.resolve(__dirname, './public/images');

const browserConfig = {
entry :
APP_DIR + 'client/index.js',
// APP_DIR + '/route/index.jsx',

resolve : {
alias:{
images : IMG_DIR
},
},
output : {
path : BUILD_DIR,
filename : "[name] bundle.js",
publicPath:BUILD_DIR,
},

module : {
    rules : [
        {
            test : /\.(js|jsx)$/,
            include : APP_DIR,
            loader : 'babel-loader',
            exclude: /node_modules/,
            query : {
            presets:[ 'react', 'es2015'],
          }
        },
        {
            test:/\.css$/,
            include: APP_DIR,
            loader:['style', 'css']
        },
        {
            test:/\.scss$/,
            include: APP_DIR,
            use: ExtractTextPlugin.extract({
              fallback: "style-loader",
              use: "css-loader!sass-loader"
            })
        },
        {
          test: /\.(png|jpg|gif)$/,
          use : [
            {
              loader: 'url-loader',
              options:{
                limite:8192
              }
            }
          ]
        }
    ]
  },
  plugins: [
    new ExtractTextPlugin("styles.css"),
    // new HTMLPlugin(),
    new HTMLPlugin(),
  ]

};
but when i run webpack

C:\Idessign>webpack
Hash: 18bc2fd105d4883da519
Version: webpack 4.3.0
Time: 116ms
Built at: 2018-3-28 12:58:19

WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.

ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Idessign'

C:\Idessign>

montogeek

montogeek commented on Mar 28, 2018

@montogeek
Member

Yes, configuration is correct, but again, your paths are not:
const APP_DIR = path.resolve(__dirname, "./src/");: src folder doesn't exist.

frankshin

frankshin commented on Apr 1, 2018

@frankshin

i have the same problem when use webpack4.2.0. is this problem solved?

frankshin

frankshin commented on Apr 3, 2018

@frankshin

it's caused by the error setting of 'script', you can inspect is it error
eg: 'webpack-dev-server --inline --progress --port 8001 --config webpack.dev.js'

matheus1lva

matheus1lva commented on Apr 3, 2018

@matheus1lva
Member

@frankshin to help even more people here, if possible create a simple repository, where it is capable to reproduce your problem. This can help even more when they are making tests for it. Because this can be a configuration problem, rather than an error with webpack.

Inokinoki

Inokinoki commented on Apr 3, 2018

@Inokinoki

Excuse me.
The same problem occurred in my tiny project so I arrived at this page.
I tried to build a smallest project to reproduce it.
here
Thank you for glancing over it.

ooflorent

ooflorent commented on Apr 3, 2018

@ooflorent
Member

@Inokinoki webpack searches for src/index.js. The file does not exist so it throws an error. Moreover, .jsx are not handled without a loader.

15 remaining items

scotmatson

scotmatson commented on May 16, 2018

@scotmatson

Just came across this error, while walking through this documentation, https://webpack.js.org/guides/getting-started/

In my case, was due to the working directory in relation to the npx command. I needed to be in the root of my project before running npx webpack.

paul-hammant

paul-hammant commented on May 20, 2018

@paul-hammant
ERROR in Entry module not found: Error: Can't resolve './src/index.js' in '<dir>' 

^ Would be more clear.

yukha

yukha commented on May 25, 2018

@yukha

maybe you need to use backslash? '.\src\index.js'

zifn4b

zifn4b commented on May 26, 2018

@zifn4b

This particular issue I believe has to do with when webpack resorts to its default configuration on Windows it tries to resolve ./src and can't. It would need to resolve .\src instead. That's probably a bug.

iFlameing

iFlameing commented on May 26, 2018

@iFlameing

This particular issue is arise due to misconfigured path configuration. The folder in which webpack.config.js file exists does not contains the './src' folder so see the folder structure carefully to remove the bug.

domainoverflow

domainoverflow commented on May 27, 2018

@domainoverflow

if for some reason you used utf-8, i.e.: accented characters ( IDN, ex: é ) will also lead to this problem even though the underlying OS ( in this case centos 7 ) file system does not have a problem with it.
If the IDN character is a domain name, you can bypass this bug by converting it to punycode
(xn--...... . tld ).
One thing is for sure, user mishap or not, closing this issue every other week will not make it go away.

ddagsan

ddagsan commented on May 28, 2018

@ddagsan

try to go up folder, not src.

Shanuchauhan

Shanuchauhan commented on Jun 14, 2018

@Shanuchauhan

Hey,first you have to set the mode to development.
In the package.json file , you need to type this :
"scripts": {
"build": "webpack --mode production"
}
then the src problem is you have to create a src folder in which you have to create a index.js file.
then try running npm run build.
It works.

mqliutie

mqliutie commented on Jun 19, 2018

@mqliutie

mark

SirajKakeh

SirajKakeh commented on Jul 4, 2018

@SirajKakeh

I double @zifn4b and @domainoverflow, I spent hours on Windows trying to solve this but when tried the same project on Ubuntu 16.04 it worked like magic!

domainoverflow

domainoverflow commented on Jul 9, 2018

@domainoverflow

and yet @SirajKakeh the issue is closed every other week ..

SomeoneIsWorking

SomeoneIsWorking commented on Jul 13, 2018

@SomeoneIsWorking

Why is the issue closed?

locked and limited conversation to collaborators on Jul 14, 2018
ooflorent

ooflorent commented on Jul 14, 2018

@ooflorent
Member

For everyone encountering this issue, it is most probably a configuration issue.

If you still think it is a bug, please open a new issue including an example to reproduce the error. Best put it in a GitHub repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @paul-hammant@ooflorent@phcoliveira@matheus1lva@montogeek

        Issue actions

          ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Idessign' · Issue #6858 · webpack/webpack