Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow system npm in "emsdk install emscripten" #723

Merged
merged 2 commits into from
Feb 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,10 +1243,16 @@ def find_latest_installed_tool(name):
def emscripten_npm_install(tool, directory):
node_tool = find_latest_installed_tool('node')
if not node_tool:
print('Failed to run "npm ci" in installed Emscripten root directory ' + tool.installation_path() + '! Please install node.js first!')
return False
npm_fallback = which('npm')
if not npm_fallback:
print('Failed to find npm command!')
print('Running "npm ci" in installed Emscripten root directory ' + tool.installation_path() + ' is required!')
print('Please install node.js first!')
return False
node_path = os.path.dirname(npm_fallback)
else:
node_path = os.path.join(node_tool.installation_path(), 'bin')

node_path = os.path.join(node_tool.installation_path(), 'bin')
npm = os.path.join(node_path, 'npm' + ('.cmd' if WINDOWS else ''))
env = os.environ.copy()
env["PATH"] = node_path + os.pathsep + env["PATH"]
Expand Down