簡體   English   中英

從git checkout構建yeoman項目

[英]Build yeoman project from git checkout

我正面臨着從git建立yeoman項目結賬的問題。 我試圖采取自定義項目的git結帳並運行grunt服務 以下是錯誤描述后面的方案

場景描述:

Person1使用yo angular創建了yeoman angularjs項目。 grunt servePerson1的計算機上工作正常。 Person1將代碼推送到git,以便其他團隊成員可以使用它。

Person2結帳git時會出現問題( git clone <URL> )。 簽出副本中的grunt serve命令將給出以下錯誤:

$ grunt serve
grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started

我試過了: npm install grunt

我收到以下錯誤:

grunt serve
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'load-grunt-tasks'
Warning: Task "serve" not found. Use --force to continue.

Aborted due to warnings.

使用的工具 :

$ grunt -version
grunt-cli v0.1.13
grunt v0.4.4
$ yo -v
1.1.2
suraj@localhost:testing$ npm -version
1.4.4

ls -l在目錄上

drwxrwxr-x app
-rw-rw-r-- bower.json
-rw-rw-r-- Gruntfile.js
-rw-rw-r-- karma.conf.js
-rw-rw-r-- karma-e2e.conf.js
drwxrwxr-x node_modules
-rw-rw-r-- package.json
drwxrwxr-x test

我需要幫助完成從git checkout構建項目的任務,所以我可以繼續開發。

在App-Directory中執行簡單的npm install

問題是:Yeoman-Projcet有很多npm依賴,不僅是grunt本身,還有所有grunts任務和生成器。 但是,當然你不希望你的存儲庫中的所有這些包。 這就是“package.json”文件的來源:它列出了項目所依賴的所有包。 npm install讀取package.json並自行安裝所有需要的包。

要正確運行應用程序,您還需要執行bower install Bower用於Frontend-Packages,npm用於節點。 “bower install”在“bower.json”-File中查找依賴包並安裝它們。

解決了兩個步驟。 以下命令:

  1. npm安裝
  2. 涼亭安裝

現在運行grunt服務

$ grunt serve
Running "serve" task

Running "clean:server" (clean) task

Running "bower-install:app" (bower-install) task

Running "concurrent:server" (concurrent) task

    Running "compass:server" (compass) task
    directory .tmp/styles/ 
       create .tmp/styles/main.css (8.454s)
    Compilation took 8.455s

    Done, without errors.


    Execution Time (2014-03-13 10:53:01 UTC)
    compass:server  9.1s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
    Total 9.1s

Running "autoprefixer:dist" (autoprefixer) task
Prefixed file ".tmp/styles/main.css" created.

Running "connect:livereload" (connect) task
Started connect web server on 127.0.0.1:9000.

Running "watch" task
Waiting...

這解決了這個問題。

讓我知道這是否可以避免或以更好的方式完成:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM