Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module '/Users/pro/demo/webpack.config.js' #8178

Closed
thecicada opened this issue Dec 6, 2019 · 3 comments
Closed

Error: Cannot find module '/Users/pro/demo/webpack.config.js' #8178

thecicada opened this issue Dec 6, 2019 · 3 comments

Comments

@thecicada
Copy link

Environment
My environment is as follows:
1 - Emulator: Pixel 3A
2 - Device: Galaxy s8+
3 - OS: android 9
4 - SDK: 28
5 - NativeScript: 6.2.0

Describe the bug
I'm having issue getting NativeScript to work after upgrading it to the latest version, when I create new project and try to run it tns run android I get the following error:


Error: Cannot find module '/Users/pro/demo/webpack.config.js'
Require stack:
- /Users/pro/demo/node_modules/webpack-cli/bin/convert-argv.js
- /Users/pro/demo/node_modules/webpack-cli/bin/cli.js
- /Users/pro/demo/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (/Users/pro/demo/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at WEBPACK_OPTIONS (/Users/pro/demo/node_modules/webpack-cli/bin/convert-argv.js:133:13)
    at requireConfig (/Users/pro/demo/node_modules/webpack-cli/bin/convert-argv.js:135:6)
    at /Users/pro/demo/node_modules/webpack-cli/bin/convert-argv.js:142:17
    at Array.forEach (<anonymous>)
    at module.exports (/Users/pro/demo/node_modules/webpack-cli/bin/convert-argv.js:140:15)
    at /Users/pro/demo/node_modules/webpack-cli/bin/cli.js:241:39
    at Object.parse (/Users/pro/demo/node_modules/yargs/yargs.js:567:18)
    at /Users/pro/demo/node_modules/webpack-cli/bin/cli.js:219:8
    at Object.<anonymous> (/Users/pro/demo/node_modules/webpack-cli/bin/cli.js:538:3)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/pro/demo/node_modules/webpack/bin/webpack.js:155:2)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/pro/demo/node_modules/webpack-cli/bin/convert-argv.js',
    '/Users/pro/demo/node_modules/webpack-cli/bin/cli.js',
    '/Users/pro/demo/node_modules/webpack/bin/webpack.js'
  ]
}
Executing webpack failed with exit code 1.

I tried to uninstall node and NativeScript and install them again, but still getting the same error.
I tried to create new project and run it using sidekick but still getting the same error

Webpack seem not to be creating webpack.config.js at all, I can see the plugin is being installed but it doesn't create a webpack.config.js file.

@NickIliev
Copy link
Contributor

@thecicada what is the version of your nativescript-dev-webpack?

Try running the following:

npm i nativescript-dev-webpack@latest --save-dev
 ./node_modules/.bin/update-ns-webpack --deps --configs
npm i

@thecicada
Copy link
Author

@NickIliev Thank you for your response. The version of nativescript-dev-webpack is 1.3.0

I ran

npm i nativescript-dev-webpack@latest --save-dev
 ./node_modules/.bin/update-ns-webpack --deps --configs
npm i

And it worked just fine, thank you. I wonder why this happens for newly created projects. So whenever I create new project in the future, I have to run that commend

@DimitarTachev
Copy link

@thecicada

The above-mentioned update commands are executed during the postinstall scripts of the nativescript-dev-webpack plugin.

A possible reason for not getting the webpack.config.js could be disabled npm scripts. You could check their status by executing npm config get ignore-scripts. If your scripts are not disabled, I suggest you remove your node_modules and execute npm i --loglevel verbose in order to check the logs of the nativescript-dev-webpack' post-install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants