jscomplete / learn-fullstack-javascript Goto Github PK
View Code? Open in Web Editor NEWFor help, ask in #questions at jscomplete.com/help
Home Page: https://jscomplete.com/help
License: GNU General Public License v3.0
For help, ask in #questions at jscomplete.com/help
Home Page: https://jscomplete.com/help
License: GNU General Public License v3.0
Hi $ npm run dev command give me error
[email protected] dev C:\xampp\htdocs\react
webpack -wd
'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] dev: webpack -wd
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
package.json
"dependencies": {
"body-parser": "^1.15.2",
"bootstrap": "^3.3.7",
"ejs": "^2.5.2",
"express": "^4.14.0",
"jquery": "^3.3.1",
"json-loader": "^0.5.4",
"mongodb": "^2.2.10",
"node-sass-middleware": "^0.9.8",
"react": "^15.3.2",
"react-dom": "^15.3.2"
},
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-eslint": "^7.0.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.17.0",
"eslint": "^3.7.1",
"eslint-plugin-react": "^6.4.0",
"nodemon": "^1.11.0",
"webpack": "^1.13.2"
}
/Users/axez/Desktop/Learning Full-Stack javascript Development_ MongoDB, Node and React/learn-fullstack-javascript-master/node_modules/mongodb/lib/mongo_client.js:377
throw err
^
AssertionError: null == { MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
When I save any new change (even a minor one), I have to rebuild the entire web pack, in order to see the change in the browser.
First, I run "npm run dev" (which seems to be rebuilding the web pack)
Then, I run "npm run start"
I tried to update the package.json per all of the comments on the issues.
Am I missing something? Thanks
package.json:
{
"name": "",
"version": "1.0.0",
"description": "l",
"main": "server.js",
"scripts": {
"start": "nodemon --exec babel-node server.js --ignore public/",
"dev": "webpack -wd"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
"axios": "^0.15.0",
"body-parser": "^1.15.2",
"ejs": "^2.5.2",
"express": "^4.14.0",
"json-loader": "^0.5.4",
"mongodb": "^2.2.10",
"node-sass-middleware": "^0.11.0",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"webpack-cli": "^3.0.8"
},
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-eslint": "^7.0.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.17.0",
"eslint": "^3.7.1",
"eslint-plugin-react": "^6.4.0",
"nodemon": "^1.11.0",
"webpack": "^3.12.0"
}
}
Following the steps at https://www.youtube.com/watch?v=kSsJKyTNOyw&index=5&list=PLndrmkbqEI8WrbdSUmxu0mxOB8ohahLrZ, I'm getting stuck at the ./node-modules/.bin/babel-node server.js
I'm getting this message:
Error: Cannot find module '../lib/babel-node'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object. (/Users/nigeldasilvalima/Dropbox/JsStack/fulljs/node_modules/.bin/babel-node:3:1)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
I followed all the steps on this video and previous ones. I have no idea of why this is happening. I appreciate any helpt
`C:\Users\hp\learn-fullstack-javascript>babel-node server.js
(node:16052) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ...to show where the warning was created)
C:\Users\hp\learn-fullstack-javascript\server.js:1
import config, { nodeEnv, logStars } from '/config';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at loader (C:\Users\hp\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions. [as .js] (C:\Users\hp\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:154:7)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at Object. (C:\Users\hp\AppData\Roaming\npm\node_modules\babel-cli\lib_babel-node.js:154:22)
at Module._compile (node:internal/modules/cjs/loader:1105:14)`
When i try to "npm run dev" in console im getting this error:
ERROR in ./src/testData.json
Module build failed: SyntaxError: Unexpected token
in JSON at position 262
at Object.parse (native)
at Object.module.exports (/Users/williamwedmedyk/jsPrac/jscomplete/node_modules/json-loader/index.js:11:48)
@ ./src/index.js 11:16-37
here is my index.js file:
5 module.exports = function(source) {
6
7 if (typeof source === "string" && source.indexOf("module.exports = ") === 0) {
8 return source;
9 }
10 this.cacheable && this.cacheable();
11 var value = typeof source === "string" ? JSON.parse(source) : source;
12 this.value = [value]; 13 return "module.exports = " + JSON.stringify(value, undefined, "\t") + ";";
14 }
Hi Samer.
When I start with files from Exercise Files\Ch05\05_02
and enter the command curl http://localhost:8080
I get this in my console:
{ Error: connect EADDRNOTAVAIL 0.0.0.0:8080
at Object.exports._errnoException (util.js:1050:11)
at exports._exceptionWithHostPort (util.js:1073:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
code: 'EADDRNOTAVAIL',
errno: 'EADDRNOTAVAIL',
syscall: 'connect',
address: '0.0.0.0',
port: 8080,
config:
{ adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
{ Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/0.15.3' },
method: 'get',
url: 'http://0.0.0.0:8080/api/contests',
data: undefined },
response: undefined }
and empty HTML markup:
<!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>Naming Contests</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="/style.css" media="screen">
</head>
<body class="container">
<div id="root"></div>
<script src="/bundle.js" charset="utf-8"></script>
</body>
</html>
All npm modules are installed.
Node.js ver. 7.9.0
npm ver. 4.2.0
Hi, Your tutorial on Full stack is very helpful to learn JS. However, I am facing an issue while importing http module in server.js. It says can not find module "http". I am using a windows environment. Is there a work around to this situation.
P.S. - Https gets imported successfully
I'm working through part 2.3 and there is some problem running the lines
router.get('/',(req, res) => {
res.send({ data: [] });
});
in index.js in the api folder.
I'm getting an error like
/home/ubuntu/workspace/api/index.js:15
router.get('/', function (req, res) {
^TypeError: Cannot read property 'get' of undefined
if I take that out and put
server.get('/api',(req, res) => {
res.send({ data: [] });
});
in the server.js folder it seems to work like your example.
Is there a reason I should not do that?
import config from './config';
^^^^^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:723:23)
at loader (/home/francisco/Documents/Programming Courses/learn-fullstack-javascript/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/francisco/Documents/Programming Courses/learn-fullstack-javascript/node_modules/babel-register/lib/node.js:154:7)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at Object. (/home/francisco/Documents/Programming Courses/learn-fullstack-javascript/node_modules/babel-cli/lib/_babel-node.js:154:22)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
That's the error message I get. I've cloned the current version with Tag 2.3-end from your GitHub. Can you help me?
I am stuck. Not able to get the part that displays "Hello React" working. Please help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.