首页 > 解决方案 > 运行“npm run build”时,它不会创建构建目录

问题描述

我对使用 React 还是有点陌生​​。我正在尝试使我的 git 存储库对 GitHub 页面可见。

运行时npm run build,它成功编译,但不会创建构建文件夹。

结果,当我尝试运行npm run deploy它时,它会一直运行,直到收到此错误:ENOENT: no such file or directory, stat '/Users/alejandro/Documents/FSMX/FSMX/build'

这是我的package.json代码

  "version": "1.0.0",
  "description": "FSM X Project",
  "main": "index.js",
  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "start": "parcel index.html",
    "build": "parcel build index.html" 

这是我的index.html代码

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="./src/images/test.png" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta
      name="description"
      content="FSMX Experience"
    />
    <title>FSMX Project</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <script src="./src/index.js"></script>
  </body>
</html>


有什么建议么?

标签: reactjsnpmgithub-pagesnpm-build

解决方案


推荐阅读