简体   繁体   English

无法创建 WebStorm React 项目

[英]Can't create WebStorm React project

I'm trying to create a React project in WebStorm 2016.3.1我正在尝试在 WebStorm 2016.3.1 中创建一个 React 项目

It's asking me for a create-react-app but I have no idea what that is and I can't find any reference on Google.它要求我提供一个create-react-app,但我不知道那是什么,我在 Google 上找不到任何参考。

What is it and where can I find the value?它是什么,我在哪里可以找到它的价值?

在此处输入图片说明

You need to install create-react-app npm module, before you use this feature.在使用此功能之前,您需要安装create-react-app npm 模块。

npm install -g create-react-app

You can read more about this feature on the official release blog of WebStorm .您可以在WebStorm官方发布博客上阅读有关此功能的更多信息。

Excerpt from the documentation :文档摘录:

Make sure that you have create-react-app installed globally on your computer, for that run npm install -g create-react-app.确保您在计算机上全局安装了 create-react-app,为此运行 npm install -g create-react-app。 Then to start your new project, double click on the start task in the npm tasks tool window to run it.然后要启动你的新项目,双击 npm 任务工具窗口中的启动任务来运行它。 That's it!就是这样!

I had ie installed create-react-app globally using yarn and webstorm failed to find it.我已经使用纱线全局安装了create-react-app并且 webstorm 找不到它。 Then I used npm , not to mention globally and its working like a charm.然后我使用了npm ,更不用说在全球范围内,它的工作方式就像一个魅力。

I created webStrom react app following this steps.我按照以下步骤创建了 webStrom react 应用程序。

  1. Download node.js下载node.js
  2. Open command line console and type "npm install -g create-react-app"打开命令行控制台并输入“npm install -g create-react-app”
  3. Create react app project from web-storm.从 web-storm 创建 react 应用项目。
  4. Make sure you provided the correct file path of create-react-app , by default it is installed in ~\\AppData\\Roaming\\npm\\node_modules\\create-react-app确保您提供了正确的 create-react-app 文件路径,默认情况下它安装在 ~\\AppData\\Roaming\\npm\\node_modules\\create-react-app

use npm start: to start development server使用 npm start: 启动开发服务器

TL;DR TL; 博士
No need to install anything.无需安装任何东西。 Just enter npx create-react-app in the create-react-app field & it should work like a pycharm, I mean charm :)只需输入npx create-react-app在创造-反应,应用领域和它应该像一个pycharm,我的意思是魅力:)

Side note : npx is pre-bundled with npm since npm version 5.2.0.旁注:自 npm 5.2.0 版以来,npx 与 npm 预捆绑在一起。

If you are using asdf or any other tool to manage multiple versions of nodejs, you will need to set up the path to create-react-app manually如果您使用asdf或任何其他工具来管理多个版本的 nodejs,则需要手动设置create-react-app的路径

I'm on mac, so for me the path was我在 mac 上,所以对我来说路径是

/Users/<USER>/.asdf/installs/nodejs/12.16.2/.npm/lib/node_modules/create-react-app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM