I tried to get into react following the react tutorials and got it working, but when I started to go to the next step and use react-router through this tutorial I failed every time!
When I follow the instructions everything seems to be working OK, no errors on terminal, but I don't see any bundle.js files created in my project folder nor the localhost:8080 shows anything other than the following error in console:
GET http://localhost:8080/ net::ERR_EMPTY_RESPONSE
I tried installing npm locally and globally but none worked, same as webpack. Also I tried running the servers using webpack with the code webpack ./index.js bundle.js doesn't work either and throws the following error in terminal:
ERROR in multi main
Module not found: Error: Cannot resolve module 'bundle.js' in /Users/jafari/Desktop/React-Toturial/react-router-tutorial/lessons/01-setting-up
# multi main
While this code creates the bundle.js file and if I run this folder through MAMP on the localhost I can see the desired content of the tutorial, when I change anything in the App.js it doesn't take effect until I remove the bundle.js and do the process I mentioned earlier again in the terminal while still seeing the following error in the console:
bundle.js:49 Uncaught Error: Cannot find module "bundle.js"
And if I don't remove bundle.js I get this error in the console:
Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:(client) <div data-reactid="(server) <div data-reactid="
Any ideas? or alternatively any suggestion or tutorial on how to use react-router?
Try to change the port to something else with the command webpack-dev-server --port 3000 --inline --content-base
You can also substitute the npm start script in the package.json with that line.
Related
screen shot
this is my first ever react app am following a simple tutorial.
and for some reason i keep getting errors for every jsx file i create although the tutorial am following doesn't have them although we have matching codes
i installed yarn and npm and sass although npm has 6 vulnerabilities.
and fixing them using the fix force code on the terminal always creates more errors and i have been going along the tutorial and everything compiles
error codes below
Document not found: src/components/navbar/navbar.jsx polymer-ide(unable-to-analyze) [ln1, col1]
I am learning react from a playlist and had created a basic app with create-react-app it was up and running without any issues initially. After I deleted some files in 'src' and 'public' ,the terminal is showing this error:
./src/index.js
Module not found: Can't resolve './App' in 'C:\Users\user\Desktop\react-challenge\sample\src'
I deleted everything except for 'index.html' in public and 'index.js' in src file. I have attached the folder structure and index.js below.
EDIT: it was an issue regarding the files getting saved and reloading it is solved now.
It's fine to delete App.js if you're not using it, and it looks like you're not.
You probably just need to restart your development server.
Stop it with Ctrl + C
Start it again with npm start or yarn start
power off your code editor and start again the code editor then run npm start in the terminal
I am using razzle for my react js app. when I run razzle start --verbose I get
✖ Client
Compiled with some errors in 4.88s
✖ Server
Compiled with some errors in 1.46s
I do not however get what the errors are.I have tried to find a way to get errors to be revealed but have had no luck.
Does anyone know how to configure so that you actually get the errors output?
What has helped me before is to do npm run build or razzle build, which usually means I missed an import.
I am trying to compile my first React Native project, and it all works fine from the CLI, until I try to install a new library.
After installing any library, I get various errors, culminating in this:
error: bundling failed: Error: While trying to resolve module `react` from file `/Users/myname/Desktop/Projects/ProjectName/App.js`, the package `/Users/myname/Desktop/Projects/ProjectName/node_modules/react/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/myname/Desktop/Projects/ProjectName/node_modules/react/index.js`. Indeed, none of these files exist:
I have, indeed, confirmed that those files exist.
What is going on here? I'm constantly having these errors as I am trying to use React Native, even when rebuilding the app multiple times and trying over.
Do the following steps:
Stop metro bundler
Delete node_modules folder
cd into your project folder and run:
'npm install'
I have an app that works in the following way:
Client bundles are built with webpack and output to /client/app/public/build.
An express server runs from /server/index.js and renders a handlebars template using some environment variables.
After I run yarn run build and the postbuild script is executed, it fails immediately with the following error:
yarn run v1.9.4
$ react-snap
events.js:183
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open '/Users/aington/git/static-help/build/index.html'
error Command failed with exit code 1.
This makes sense, since there are no files in that location.
I know that react-snap prides itself on being a zero-configuration library, but I really would like to configure it so that it can point to the right directory for serving files. Additionally, the Express server provides an authentication library, so that needs to run too.
Is it realistic to expect that react-snap can do this and still crawl and pre-render the site? Or should I explore other options?
Check the default options in index.js
https://github.com/stereobooster/react-snap/blob/97542b802917362773a2601f52d368c01bd5e0f7/index.js#L15
and use it in package.json like the below
"reactSnap" : {
"source" : "./dist"
}