首页
学习
活动
专区
圈层
工具
发布

一个 create-react-app v5 的问题

前言 前两天我准备用 create-react-app 创建一个新项目,然后我在命令行下执行 npx create-react-app my-app 命令行下就会提示 Need to install the...然后我就输入 npm uninstall -g create-react-app 进行全局卸载,然后再执行 npx create-react-app my-app 创建,结果还是上面的提示。...调用项目中的安装模块 原先要执行 node-modules/.bin/jest 代替 npx jest 避免全局安装模块 npx create-react-app my-app 上面代码运行时,npx...解决办法 方案一 使用固定版本号 npx create-react-app@5 方案二 使用 npm init代替 npm init react-app my-app 方案三...先清除 npx 缓存然后在初始化 npx clear-npx-cache npx create-react-app my-app 以上就是本文全部内容,希望这篇文章对大家有所帮助,也可以参考我往期的文章或者在评论区交流你的想法和心得

1.4K20
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    react开发环境搭建

    以下是使用 create-react-app 工具的标准步骤,这是最常用的方法: 使用 create-react-app 创建 React 项目 确保你已安装 Node.js 和 npm 你可以通过以下命令检查是否安装了...安装 create-react-app 你可以全局安装 create-react-app 工具(可选): npm install -g create-react-app 创建一个新的 React 项目...使用 create-react-app 创建一个新的项目,替换 my-app 为你想要的项目名称: npx create-react-app my-app npx 是 npm 5.2.0 及更高版本随附的工具...进入项目目录 进入你创建的项目文件夹: cd my-app 启动开发服务器 启动项目的开发服务器: npm start 默认情况下,开发服务器会在 http://localhost:3000 运行。...为你的项目名称: npm create vite@latest my-app --template react 进入项目目录 cd my-app 安装依赖 npm install 启动开发服务器

    58910

    create-react-app初探

    通过3种方式快速创建一个React SPA应用: npm init with initializer (npm 6.1+) npx with generator (npm 5.2+) yarn create...with initializer (yarn 0.25+) 例如我们新建一个叫my-app的SPA: my-app ├── README.md ├── node_modules ├── package.json...create-react-app my-app --typescript # or yarn create react-app my-app --typescript 当然,如果我们是把一个CRA已经生成的...development'; process.env.NODE_ENV = 'development'; 因为是开发模式,所以这里把babel,node的环境变量都设置为development,然后是全局错误的捕获...因为create-react-app my-app之后通过模版生成的项目中入口脚本被放置在src/index.js,而入口html被放置在public/index.html,所以需要对这两个文件进行检查

    1.6K10
    领券