2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-14 09:14:04 +00:00

Prompt to install yarn in global

This commit is contained in:
Faris Ansari 2018-02-20 17:12:19 +05:30
parent 6e73871e55
commit 4497267269

View File

@ -431,13 +431,15 @@ def update_npm_packages(bench_path='.'):
print('Updating node libraries...') print('Updating node libraries...')
apps_dir = os.path.join(bench_path, 'apps') apps_dir = os.path.join(bench_path, 'apps')
if not find_executable('yarn'):
print("Please install yarn using below command and try again.")
print("`npm install -g yarn`")
return
for app in os.listdir(apps_dir): for app in os.listdir(apps_dir):
app_path = os.path.join(apps_dir, app) app_path = os.path.join(apps_dir, app)
if os.path.exists(os.path.join(app_path, 'package.json')): if os.path.exists(os.path.join(app_path, 'package.json')):
yarn_executable = './node_modules/.bin/yarn' exec_cmd('yarn install', cwd=app_path)
if not os.path.exists(os.path.join(app_path, yarn_executable)):
exec_cmd('npm install yarn', cwd=app_path)
exec_cmd('{yarn} install'.format(yarn=yarn_executable), cwd=app_path)
def install_requirements(pip, req_file): def install_requirements(pip, req_file):