Categories
Mastering Development

Making changes to app after deploy to heroku and running npm build

I deployed my REACT application to Heroku and everything works fine but how do I run it locally and make changes? when I use npm start it boots up on port 8080 (which was the port I was told to use by a tutorial) but not on 3000. When I got to localhost:8080 my website […]

Categories
Mastering Development

Getting an error: `ReferenceError: Cannot access ‘imported const’ before initialization` in react

Node v: “10.14.1” React v: “^16.9.0” After updating some packages locally by running npm update, I started getting this error when I start my react project. ReferenceError: Cannot access ‘USER_LOGIN_PENDING’ before initialization Module.USER_LOGIN_PENDING http://localhost:3300/static/js/main.chunk.js:28487:110 push../src/state/reducers/auth.js.__webpack_exports__.default src/state/reducers/auth.js:23 20 | 21 | export default (state = INITIAL_STATE, action) => { 22 | switch (action.type) { > 23 […]

Categories
Mastering Development

How to allow import meta?

I am using ES modules in my Express backend to allow for module imports. I have replaced __dirname with: const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); Server itself is up and running, however when I try to build the app, the process crashes with: ./src/server/server.js SyntaxError: C:\Projects\lore_hunters\src\server\server.js: Support for the experimental syntax ‘importMeta’ isn’t […]

Categories
Mastering Development

MERN applying href to render/return

Progressing in MERN stack when I ran into an issue displaying some data as an href onto the page. As stated, I can return the data to the screen, so far only in an un-ordered list. Here is the code: import React, { Component } from ‘react’; import ‘./customers.css’; class Customers extends Component { constructor() […]

Categories
Mastering Development

React and Nodejs

I’ve issue in connecting react and express nodejs. On production they are fine together but on dev they are not connected. I’ve read a lot of articles and none of them worked with me. I’m deploying on heroku. And on production how can I replace local host end points with heroku url. const express = […]

Categories
Development

Axios post request fails to use proxy

I’m currently testing out the endpoints on my server via a React client using Axios. I have a proxy (http://localhost:8080) set up in my package.JSON for my client. All my GET requests are successful. My POST requests on the other-hand all fail to make use of the proxy provided in package.JSON, instead, it’s using (http://localhost:3000). […]

Categories
Development

Why is this React Typescript app throwing errors?

I just created a new React app using npx create-react-app my-app –template typescript and it was working fine until I changed my component to from a stateless one to a stateful one. The error: JSX element type ‘App’ is not a constructor function for JSX elements. TS2605 3 | import App from “./App”; 4 | […]

Categories
Development

“eslint: Permission denied” when deploying React app on Firebase through GitLab

I’m currently trying to setup CI through GitLab for my React app hosted on Firebase. I’m struggling to get past this point. There were some other post suggesting the use of sudo but the console told me the command was not found. Any help would be greatly appreciated. Thanks you. Here are my current configurations: […]

Categories
Development

React Storybook not working on Windows 10

I am just following the get started guide for Storybook with React. When I run the command yarn run storybook, I get an error: Usage Error: Couldn’t find a script named “storybook”. I have tried on my Macbook, and it works fine everytime, so I am not sure whay it is doing that. I have […]

Categories
Development

“Error: Cannot find module” when deploy react app to elastic beanstalk

I am trying to deploy my create-react-app to an environment in my Elastic Beanstalk application but I get the error “Error: Cannot find module ‘../../context’”. The app works fine when I run local and I do not get an error on the EB deploy process, but when I open the app I get an error. […]