Yarn start - Command failed with exit code 1 - reactjs

I'm having a little problem while trying to run "Yarn start" in my ReactJS project.
The error is pasted below:
yarn run v1.22.5
$ webpack-dev-server --mode development
The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\3AM\web\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\3AM\web\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\3AM\\web\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I've tried to install webpack-dev-server with npm and yarn, but it didn't solve.

In package.json change the start script to "start": "webpack serve".

Related

React Native Error: Cannot find module metro/src/shared/output/bundle

command
npx react-native init gonative
I ran this command in root terminal (parrot linux) and encountered with error.
It says cannot find module 'metro/src/shared/output/bundle'
Node version : v17.3.0
npm version: 8.3.0
npx version : 8.3.0
output
Need to install the following packages:
react-native
Ok to proceed? (y) y
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'metro/src/shared/output/bundle'
Require stack:
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/bundle.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/bin.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js:64:22)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/bundle.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/bin.js'
]
}
Remove global react-native installer
npm uninstall -g react-native-cli #react-native-community/cli
Install metro bundler
npm install --save-dev metro metro-core
Close all terminal/shell, and then run your command again

MODULE NOT FOUND after running axios

While I was compiling the code using npm start an error occurred.
I create the Axios Instance by running npm install --save axios , but after that i run yarn start its not running.strong text
Here is the error log:
yarn run v1.22.4
$ node scripts/start.js
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module 'resolve'
Require stack:
- /home/falguni/Documents/the_burger_builder/config/webpack.config.js
- /home/falguni/Documents/the_burger_builder/scripts/start.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/falguni/Documents/the_burger_builder/config/webpack.config.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1040:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/falguni/Documents/the_burger_builder/config/webpack.config.js',
'/home/falguni/Documents/the_burger_builder/scripts/start.js'
]
}
error Command failed with exit code 1.
This is showing in my terminal and it is not running the server.
Capitalize your folder names and js file names.
try
yarn add axios
instead of
npm install axios
I am not clear but i think this will work

Web server pack issue .. Module not found

I am beginner in React.js and tried many tutorials for seting up the environment for React.js!!
first it came
The CLI moved into a separate package: webpack-cli. Please install
'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D module.js:472
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (F:\ReactJs\FirstReact\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
then i run the :
npm install webpack-cli
and then i get this error below several trying may tutorials
ERROR in multi (webpack)-dev-server/client?http://localhost:8080
(webpack)/hot/dev-server.js ./src Module not found: Error: Can't
resolve './src' in 'F:\ReactJs\FirstReact' # multi
(webpack)-dev-server/client?http://localhost:8080
(webpack)/hot/dev-server.js ./src main[2]
the problem is in your webpack.config.js , please check with typo with (module.export). it should (module.exports)

when i run "npm run watch" i'm getting this error, what does it mean and how can i solve it?

> crafty#1.0.0 watch /Users/sirishasamudrala/Desktop/crafty
> webpack --progress -d --config webpack.config.js --watch
/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:243
throw err;
^
Error: Cannot find module 'extract-text-webpack-plugin'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (/Users/sirishasamudrala/Desktop/crafty/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object. (/Users/sirishasamudrala/Desktop/crafty/webpack.config.js:2:25)
at Module._compile (/Users/sirishasamudrala/Desktop/crafty/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (/Users/sirishasamudrala/Desktop/crafty/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:133:13)
at requireConfig (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:135:6)
at /Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:142:17
at Array.forEach ()
at module.exports (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:140:15)
at yargs.parse (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:240:39)
at Object.parse (/Users/sirishasamudrala/Desktop/crafty/node_modules/yargs/yargs.js:552:18)
at /Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:218:8
at Object. (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:515:3)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack/bin/webpack.js:80:2)
at Module._compile (module.js:660:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! crafty#1.0.0 watch: webpack --progress -d --config webpack.config.js --watch
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the crafty#1.0.0 watch script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/sirishasamudrala/.npm/_logs/2018-05-26T19_22_18_720Z-debug.log
It means extract-text-webpack-plugin is not installed for your project.
Either run
npm i extract-text-webpack-plugin -D
Or
Add it to your package.json manually and run npm i
This usually happens when you copy paste code into your webpack config and forget to update your dependencies.
Do the same for all missing modules.

webpack-dev-server command getting cannot find module 'http-parser-js'

In one of the project setup, I followed as given the instructions.
>sudo npm install -g gulp
>sudo npm install -g coffee-script
>sudo npm install -g webpack
>sudo npm install -g webpack-dev-server
#Install development dependencies
>npm install
To start the project ran gulp command it ran succesfully.
>./node_modules/.bin/gulp
Then ran the webpack-dev-server
>./node_modules/.bin/webpack-dev-server --content-base public/ --inline
Getting following error
module.js:341
throw err;
^
Error: Cannot find module 'http-parser-js'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/home/username/.nvm/versions/node/v5.5.0/lib/node_modules/webpack-dev-server/node_modules/websocket-driver/lib/websocket/http_parser.js:3:22)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
I tried removing node_modules folder install again but no luck. Let me anything I am missing.
npm i http-parser-js -g
Try above

Resources