@@ -12,6 +12,8 @@ import Control.Exception
12import System.Process
12import System.Process
13import System.Directory
13import System.Directory
14import System.Info
14import System.Info
15+import System.Exit (exitFailure)
16+import System.IO (stderr, hPutStrLn)
16findNodeProcess :: IO (Maybe String)
18findNodeProcess :: IO (Maybe String)
17findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
19findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
@@ -33,10 +35,17 @@ updateSupportCode = do
33 then callProcess "setup-win.cmd" []
35 then callProcess "setup-win.cmd" []
35 callProcess "npm" ["install"]
37 callProcess "npm" ["install"]
38+ -- bower uses shebang "/usr/bin/env node", but we might have nodejs
39+ node <- maybe cannotFindNode pure =<< findNodeProcess
36 -- Sometimes we run as a root (e.g. in simple docker containers)
40 -- Sometimes we run as a root (e.g. in simple docker containers)
37 -- And we are non-interactive: https://github.com/bower/bower/issues/1162
41 -- And we are non-interactive: https://github.com/bower/bower/issues/1162
38− callProcess "node_modules/.bin/bower" ["--allow-root", "install", "--config.interactive=false"]
42+ callProcess node ["node_modules/.bin/bower", "--allow-root", "install", "--config.interactive=false"]
39 setCurrentDirectory "../.."
43 setCurrentDirectory "../.."
45+ cannotFindNode :: IO a
47+ hPutStrLn stderr "Cannot find node (or nodejs) executable"
42-- The support modules that should be cached between test cases, to avoid
51-- The support modules that should be cached between test cases, to avoid