IDEA開發React環境配置


概述

習慣了IDEA寫代碼,也不想在下一個webstorm,而且IDEA是webstorm的父集,webstorm能干的,IDEA應該也是可以的。本篇隨便記錄下idea下的react的環境搭建。

環境

windows 10

intellij IDEA 2017.3

node.js  9.9

安裝

node.js安裝基本是傻瓜操作,在這不詳細描述。安裝完后,windows已經默認有node環境配置。

因為npm的鏡像是國外的,除非你能翻牆,否則一般是安裝不了,能的話安裝也會非常緩慢。但國內阿里開發的淘寶npm鏡像,就能滿足我們的需求。win + R 輸出cmd打開黑窗口  npm install -g cnpm --registry=https://registry.npm.taobao.org 等待安裝

出現這個就證明安裝成功

intellij IDEA

直接去官網下載,如果是免費版的可能會出現無法安裝的情況,所以建議下完整版的。激活的話,有條件購買正版,學生黨之類自己想辦法(你懂的)

進入IDEA后,ctrl + alt + s 如果沒安裝node.js是沒有這個插件的,現在我們安裝插件

在file > setting > plugins 然后手動點擊Browe rep....

在搜索里找nodejs

安裝完,重啟IDEA就能找到上圖的node.js and npm

還得在黑窗口運行  npm install -g create-react-app搭建react腳手架,然后新建一個react項目

然后等待。。。下載一些核心依賴包,出現下面文字就成功了

Inside that directory, you can run several commands:
  npm start
    Starts the development server.
  npm run build
    Bundles the app into static files for production.
  npm test
    Starts the test runner.
  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
  cd dragtest
  npm start
Happy hacking!

Done

接下去就是運行npm

成功跑起來啦。。

看瀏覽器,搭建成功

最后,初學react可看下《react入門實例》

======================================================

如發現錯誤,請及時留言,lz及時修改,避免誤導后來者。感謝!!!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM