2016-11-14 46 views
1

我想拉我的文件從git運行我的應用程序之前,我正在使用git pull && node ./bin/www和應用程序hangs.I'm新到Nodejs是否有另一種方法做到這一點?如何git拉npm開始之前與Nodejs

{ 
    "name": "matcha", 
    "version": "0.0.0", 
    "private": true, 
    "scripts": { 
    "start": "git pull && node ./bin/www" 
}, 
    "dependencies": { 
    "base-64": "^0.1.0", 
    "bcryptjs": "^2.3.0", 
    "body-parser": "~1.15.2", 
    "cookie-parser": "~1.4.3", 
    "crypto": "0.0.3", 
    "debug": "~2.2.0", 
    "ejs": "~2.5.2", 
    "express": "~4.14.0", 
    "express-session": "^1.14.2", 
    "fs": "0.0.1-security", 
    "morgan": "~1.7.0", 
    "multer": "^1.2.0", 
    "mysql": "^2.12.0", 
    "nodemailer": "^2.6.4", 
    "path": "^0.12.7", 
    "serve-favicon": "~2.3.0" 
}, 
    "repository": { 
    "type": "git", 
    "url": "https://github.com/julekgwa/Matcha.git" 
    } 
} 

enter image description here

+0

爲什麼應用程序掛起? – smnbbrv

+0

git命令完成,但'node。/ bin/www'不啓動。 – julekgwa

+0

它不會默默啓動?不應該有錯誤信息?其實我也會在git pull後添加npm install – smnbbrv

回答

0

您可以使用prestart

當您更新依賴項時,您需要運行npm install。所以腳本的例子是:

"scripts": { 
    "prestart": "git pull && npm install", 
    "start": "node ./bin/www" 
}