Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
Program that works on Codepen.io couldn't run on Visual studio code

I completed a mini connect-4 game based on the Tic-tac-toe tutorial on Reactjs official website Code:https://codepen.io/bunansia/pen/KKXXKje?editors=1010 I copied the html,css plus JS file and tried to run on VCS but failed I have installed node.js, @babel/cli @babel/core @babel/preset-env @babel/preset-react have been installed, and this is how my package.json file looks like

{
  "name": "react-connect4",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "build": "babel src/index.js --out-file public/scripts/index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@babel/cli": "^7.16.0",
    "@babel/core": "^7.16.5",
    "@babel/preset-env": "^7.16.5",
    "@babel/preset-react": "^7.16.5"
  },
  "devDependencies": {
    "@babel/plugin-transform-react-jsx": "^7.16.5"
  },
  "description": "",
  "plugins": [
    [
      "@babel/plugin-transform-react-jsx",
      {
        "throwIfNamespace": false, // defaults to true
        "runtime": "automatic", // defaults to classic
        "importSource": "custom-jsx-library" // defaults to react
      }
    ]
  ]
}

I have also created .babelrc file instructing where to find the preset

{
    "presets": ["@babel/preset-env","@babel/preset-react"]
}

Have tried multiple ways like converting original JS file to babel version

"scripts": {
    "build": "babel src/index.js --out-file public/scripts/index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  }

And I put them in the folder named "public", while js && css files are in the folder named "script" But when I run it on live-server everything is blank What can be the configuration issues?

I have added 2 lines in html file since I am using these two external scripts also

<script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda