Git Product home page Git Product logo

reactjs-basics's Introduction

ReactJS Basics

This repository accompanies my ReactJS - Basics YouTube Series.

Usage

Switch to the branch you're interested in (branches = different stages in the series) and compare/ download the source code.

reactjs-basics's People

Contributors

smax22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactjs-basics's Issues

'webpack' is not recognized as an internal or external command,

[email protected] build D:\My React\ReactApp\reactjs-basics
webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot

'webpack' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build 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! C:\Users\rohit\AppData\Roaming\npm-cache_logs\2019-01-04T14_16_53_709Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: npm run build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start 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! C:\Users\rohit\AppData\Roaming\npm-cache_logs\2019-01-04T14_16_53_756Z-debug.log

npm start error

Hello @mschwarzmueller ,
My node version 6.9.4
npm version 4.0.5

I get error on npm start in branch 02-first-component

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\apoorvashah\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 silly lifecycle [email protected]
prestart: no script for prestart, continuing
7 info lifecycle [email protected]start: [email protected]
8 verbose lifecycle [email protected]
start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]start: PATH: C:\Users\apoorvashah\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\wamp\www\reactjs-basics\node_modules.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft\Web Platform Installer;D:\wamp\bin\php\php5.6.19;C:\ProgramData\ComposerSetup\bin;C:\Users\apoorvashah\AppData\Roaming\Composer\vendor\bin;C:\sqlite;C:\Program Files\Git\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs;D:\wamp\bin\php\php5.6.19\pear;C:\Ruby22\bin;C:\Users\apoorvashah\AppData\Roaming\npm
10 verbose lifecycle [email protected]
start: CWD: D:\wamp\www\reactjs-basics
11 silly lifecycle [email protected]start: Args: [ '/d /s /c', 'npm run build' ]
12 silly lifecycle [email protected]
start: Returned: code: 1 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: npm run build
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Users\apoorvashah\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Users\apoorvashah\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd D:\wamp\www\reactjs-basics
17 error Windows_NT 6.2.9200
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Users\apoorvashah\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
19 error node v6.9.4
20 error npm v4.0.5
21 error code ELIFECYCLE
22 error [email protected] start: npm run build
22 error Exit status 1
23 error Failed at the [email protected] start script 'npm run build'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the reactjs-basics package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm run build
23 error You can get information on how to open an issue for this project with:
23 error npm bugs reactjs-basics
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls reactjs-basics
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Do you know? Thanks in advance.

'cp' is not recognized as an internal or external command,

'cp' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\dev\nodejs\node.exe" "D:\Dev\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --in line --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'webpack -d && cp src/index.html dist/index.html && webpack-dev-server --co
ntent-base src/ --inline --hot'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the reactjs-basics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs reactjs-basics
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! d:\work\reactjs\basic\npm-debug.log

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\dev\nodejs\node.exe" "D:\Dev\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: npm run build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'npm run build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the reactjs-basics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs reactjs-basics
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! d:\work\reactjs\basic\npm-debug.log

windows 8 :The syntax of the command is incorrect. npm ERR! code ELIFECYCLE

I had tough time setting up this simpe solution on windows ,seems like it is very outdated

bundle.js 3.11 kB 0 [emitted] main [0] ./src/app/index.js 40 bytes {0} [built]
The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE

output :

bundle.js 3.11 kB 0 [emitted] main
[0] ./src/app/index.js 40 bytes {0} [built]
The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base sr c/ --inline --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Not sure if it is very outdated .
Dev dependencies:
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"webpack": "^3.0.0",
"webpack-dev-server": "^2.5.0"
}

The syntax of the command is incorrect.

error

I am getting the following error when using the "copy" command while running on windows.
Please suggest, I've tried all the alternatives mentioned everywhere.

Error on "npm start"

I am getting the following error when I type npm start in terminal"

ERROR in Entry module not found: Error: Can't resolve './src' in '/Users/sona/Documents/reactjs-basics'

screen shot 2018-03-30 at 1 31 46 am

Not running on windows 10

Hi I am getting this error on windows 10.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\kazu\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 silly lifecycle [email protected]
prestart: no script for prestart, continuing
7 info lifecycle [email protected]start: [email protected]
8 verbose lifecycle [email protected]
start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]start: PATH: C:\Users\kazu\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\kazu\Downloads\reactjs-basics-01-setup\reactjs-basics-01-setup\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Users\kazu.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Users\kazu\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\xampp\php;C:\Users\kazu\AppData\Local.meteor;C:\Users\kazu\AppData\Roaming\npm
10 verbose lifecycle [email protected]
start: CWD: C:\Users\kazu\Downloads\reactjs-basics-01-setup\reactjs-basics-01-setup
11 silly lifecycle [email protected]start: Args: [ '/d /s /c', 'npm run build' ]
12 silly lifecycle [email protected]
start: Returned: code: 1 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: npm run build
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Users\kazu\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Users\kazu\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\Users\kazu\Downloads\reactjs-basics-01-setup\reactjs-basics-01-setup
17 error Windows_NT 10.0.14393
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Users\kazu\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
19 error node v6.9.2
20 error npm v4.0.5
21 error code ELIFECYCLE
22 error [email protected] start: npm run build
22 error Exit status 1
23 error Failed at the [email protected] start script 'npm run build'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the reactjs-basics package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm run build
23 error You can get information on how to open an issue for this project with:
23 error npm bugs reactjs-basics
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls reactjs-basics
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Can you please send me an audio clip

Love your courses,
please say this line : You are tearing me appart lisa !!

every video from you is creating a desire in me to watch the room.

and for that, you have my deepest respect.

ERROR in ./src/app/index.js

ERROR in ./src/app/index.js
Module parse failed: C:.........\react\reactJS-basics\src\app\index.js Unexpected token (10:12)
You may need an appropriate loader to handle this file type.
| render(){ | return ( | <div> | <h1>Hello World</h1> | </div>

displaying window with root directory

react

what should I do I have add all dependencies and package

webpack Config

const webpack = require('webpack');

module.exports = {
entry: './src/app/index.js',
module: {
    rules: [
    {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: ['babel-loader']
    }
    ]
},
resolve: {
    extensions: ['*', '.js', '.jsx']
},
output: {
    path: __dirname + '/dist',
    publicPath: '/',
    filename: 'bundle.js'
},
plugins: [
    new webpack.HotModuleReplacementPlugin()
],
devServer: {
    contentBase: './dist',
    hot: true
}
};

package.json

{
  "name": "rcbasic",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server --config ./webpack.config.js --mode development",
    "test": "echo \"No test specified\" && exit 0"
  },
  "author": "sarvesh",
  "license": "ISC",
  "dependencies": {
    "babel-preset-env": "^1.7.0",
    "react": "^16.6.0",
    "react-dom": "^16.6.0",
    "react-hot-loader": "^4.3.11",
    "react-scripts": "^2.0.5"
  },
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "webpack": "^4.23.1",
    "webpack-cli": "^3.1.2",
    "webpack-dev-server": "^3.1.10"
  }
}

index.html file

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>REACT JS</title>
</head>
<body>
    <script src="/app/bundle.js"></script>
</body>
</html>


ERROR in index.js

ERROR in ./src/app/index.js
Module build failed: Error: Cannot find module 'babel-core'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (D:\React-project\react-demo\node_modules\babel-loader\lib\index.js:3:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at loadLoader (D:\React-project\react-demo\node_modules\loader-runner\lib\loadLoader.js:13:17)
at iteratePitchingLoaders (D:\React-project\react-demo\node_modules\loader-runner\lib\LoaderRunner.js:169:2)
at runLoaders (D:\React-project\react-demo\node_modules\loader-runner\lib\LoaderRunner.js:362:2)
at NormalModule.doBuild (D:\React-project\react-demo\node_modules\webpack\lib\NormalModule.js:179:3)
at NormalModule.build (D:\React-project\react-demo\node_modules\webpack\lib\NormalModule.js:268:15)
at Compilation.buildModule (D:\React-project\react-demo\node_modules\webpack\lib\Compilation.js:146:10)
at moduleFactory.create (D:\React-project\react-demo\node_modules\webpack\lib\Compilation.js:433:9)
at factory (D:\React-project\react-demo\node_modules\webpack\lib\NormalModuleFactory.js:253:5)
at applyPluginsAsyncWaterfall (D:\React-project\react-demo\node_modules\webpack\lib\NormalModuleFactory.js:99:14)
at D:\React-project\react-demo\node_modules\tapable\lib\Tapable.js:204:11
at NormalModuleFactory.params.normalModuleFactory.plugin (D:\React-project\react-demo\node_modules\webpack\lib\CompatibilityPlugin.js:52:5)
at NormalModuleFactory.applyPluginsAsyncWaterfall (D:\React-project\react-demo\node_modules\tapable\lib\Tapable.js:208:13)
at resolver (D:\React-project\react-demo\node_modules\webpack\lib\NormalModuleFactory.js:74:11)
at process.nextTick (D:\React-project\react-demo\node_modules\webpack\lib\NormalModuleFactory.js:205:8)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

Update Router explaination to 4.20

Please update the code and the explaination of the react router and react router-dom to 4.20 and as well the props packages is deprecated prop-types as well

Error: listen EADDRINUSE 127.0.0.1:8080

In case you have something running on port 8080 (like NGINX), the npm start will fail. Fix by change the build on package.json to

"build": "webpack -d && cp src/index.html dist/index.html && webpack-dev-server --port 3001 --content-base src/ --inline --hot".

ERROR in Cannot find module 'babel-core'

Hi!

Looks like you have installed 'babel-core' as global dependency on your machine.
Mb you should add it to package.json or add a little message to the video about
npm install babel-core -g?

Best regards

Require was used before it was defined

I am using win-7
after working in webpack.config.js
i am getting this error

require was used before it was defined

in this Code
var path = require("path");
var DIST_DIR = path.resolve(__dirname, "dist");
var SRC_DIR = path.resolve(__dirname, "src");

Solution for 2018: Webpack 4 and package.json

Video 1/2/3:
https://www.youtube.com/watch?v=G40iHC-h0c0&list=PL55RiY5tL51oyA8euSROLjMFZbXaV7skS&index=4

This works in 2018, webpack 4:

webpack.config.js

const webpack = require('webpack');

module.exports = {
entry: './src/app/index.js',
module: {
    rules: [
    {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: ['babel-loader']
    }
    ]
},
resolve: {
    extensions: ['*', '.js', '.jsx']
},
output: {
    path: __dirname + '/dist',
    publicPath: '/',
    filename: 'bundle.js'
},
plugins: [
    new webpack.HotModuleReplacementPlugin()
],
devServer: {
    contentBase: './dist',
    hot: true
}
};

package.json


  {
    "name": "minimal-react-webpack-babel-setup",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "start": "webpack-dev-server --config ./webpack.config.js --mode development",
      "test": "echo \"No test specified\" && exit 0"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
      "babel-preset-env": "^1.7.0",
      "react": "^16.4.1",
      "react-dom": "^16.4.1"
    },
    "devDependencies": {
      "babel-core": "^6.26.3",
      "babel-loader": "^7.1.5",
      "babel-preset-react": "^6.24.1",
      "babel-preset-stage-2": "^6.24.1",
      "react-hot-loader": "^4.3.3",
      "webpack": "^4.15.1",
      "webpack-cli": "^3.0.8",
      "webpack-dev-server": "^3.1.4"
    }
  }

dist/index.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>My React App</title>
</head>

<body>
    <div id="app"></div>
    <script src="/bundle.js"></script>
</body>
</html>

npm start
See:
http://localhost:8080/

This is inspiration from:
github.com/rwieruch/minimal-react-webpack-babel-setup

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.