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

installation issue #91

Closed
Sharlaan opened this issue Dec 1, 2016 · 14 comments
Closed

installation issue #91

Sharlaan opened this issue Dec 1, 2016 · 14 comments

Comments

@Sharlaan
Copy link

Sharlaan commented Dec 1, 2016

Just wanted to try on my machine, but errors occured at end of npm install:
npm-debug.txt

EDIT: same goes for npm run build, it fails at end with "unknown command 'tsc'"
hope it helps.

@krausest
Copy link
Owner

krausest commented Dec 6, 2016

I'm afraid there's not much in the log that helps me. Can you try what happens when you invoke
node install.js from the command line?

@jmjpro
Copy link

jmjpro commented Dec 12, 2016

I had similar issues. I'm running on a MacOS X Sierra and I resolved the problem by running yarn add global bower rimraf, brew install maven. Then wait over 30 minutes and it works.

@agubler
Copy link

agubler commented Jan 3, 2017

Have you got typescript installed globally?

@Sharlaan
Copy link
Author

Sharlaan commented Jan 13, 2017

i stumbled upon this checklist

Here's the checklist:

  • node.js is installed and can be invoked (node -v and npm -v)
  • java is installed and can be invoked (java -version and javac -version) [needed for webdriver-java and kivi which uses the closure compiler]
  • maven is installed and can be invoked (mvn -v) [needed for webdriver-java]
  • "npm install" runs without error
    ...

Here are my results (Windows 10):

  • node -v : v6.9.4
  • npm -v : 3.10.10
  • java -version :
    java version "1.8.0_112"
    Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
  • javac -version : unknown command 'javac'
  • mvn -v : unknown command 'mvn'

... and no Typescript installed either.

Installation explanations in Readme.md would be welcome.

UPDATE: i installed maven, and set JAVA_HOME to my jdk program files dir (/!\important to reboot windows/!) and i get this with mvn -v :

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: D:\Téléchargements\apache-maven-3.3.9\bin..
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_112\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

then node install.js crashes again, pointing at :

C:\Users\Raphaël\Desktop\js-framework-benchmark\binding.scala-v10.0.1\node_modules\sbt-bin\install.js:7
Error: No binary found matching your system. It's probably not supported.
at BinWrapper.download (C:\Users\Raphaël\Desktop\js-framework-benchmark\binding.scala-v10.0.1\node_modules\bin-wrapper\index.js:207:6)

weird to see a reference to Scala o.O ?

@Sharlaan
Copy link
Author

Sharlaan commented Jan 14, 2017

Ok i decided to audit the whole installation process and fix it myself.
Sharing here what i found/refactored :

  • binding-Scala installation crashes always i don' know why => added a skipping check in install.js
  • both ember installation are missing bower => added to js-framework-benchmark/package.json
  • maven is tricky to install => added explanations in Readme.md
  • replaced command-exists in install.js with a simplified version command-exist (no callback)
  • command-exist always returns false even when yarn is installed => sent a fixing PR at original author and added a temp commandExist.js + added dependency shelljs in package.json
  • added cosmetic console.logs in install.js
  • removed useless lodash from package.json : _.each replaced with for( ... of ...)
  • same for fs-extra, apparently never used anywhere ?

package.json

{
  "name": "js-framework-benchmark",
  "version": "1.0.0",
  "description": "Simple Benchmark for Javascript client side rendering",
  "scripts": {
    "postinstall": "node install.js",
    "build": "node build.js",
    "start": "http-server -c-1 .",
    "selenium": "cd webdriver-ts && npm run selenium && npm run results"
  },
  "keywords": [
    "benchmark",
    "javascript",
    "frontend",
    "client",
    "library",
    "framework"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/krausest/js-framework-benchmark.git"
  },
  "author": "Stefan Krause",
  "license": "ISC",
  "homepage": "https://github.com/krausest/js-framework-benchmark",
  "dependencies": {
    "bower": "^1.8.0",
    "shelljs": "^0.7.6",
    "http-server": "^0.9.0"
  }
}

install.js

const path = require('path')
const { existsSync, readdirSync, statSync } = require('fs')
const exec = require('child_process').execSync
const commandExists = require('./commandExist')

const installCommand = commandExists('yarn') ? 'yarn' : 'npm install'
const root = process.cwd()
npm_install_recursive(root)

console.log(`
===================================================================
\tInstalling from root folder
===================================================================`)

function npm_install_recursive(folder) {
  const has_package_json = existsSync(path.join(folder, 'package.json'))
  if (!has_package_json) return

  // Add in the RegExp any crashing folder name
  if (folder !== root && !/scala/.test(folder)) {
    console.log(`
===================================================================
\tInstalling from ./${path.relative(root, folder)} (${installCommand})
===================================================================`)

    exec(installCommand, { cwd: folder, env: process.env, stdio: 'inherit' })
  }

  const subfolders = readdirSync(folder)
    .filter(subfolder => statSync(path.join(folder, subfolder)).isDirectory())
    .filter(subfolder => !/node_modules|css|dist|^\./.test(subfolder))
    .map(subfolder => path.join(folder, subfolder))

  for (let subfolder of subfolders) {
    npm_install_recursive(subfolder)
  }
}

commandExist.js

'use strict'
const exec = require('shelljs').exec
const os = require('os')

// MacOS X -> 'darwin', Linux -> 'unix'
const isWindows = os.platform() === 'win32'

const commandChecker = isWindows ? 'where ' : 'command -v '

module.exports = (command) => {
  if (!command) throw new Error('Command Exist Check Error: please specify a command name to check')
  const result = exec(commandChecker + command, { silent: true })
  return !!result.stdout
}

Readme.md

## Installing

REQUIRED: you must preinstall nodejs, jdk and maven

- to install NodeJS, just use the official installer @ nodejs.org
- check if installation went correctly with ```$ npm -v```

- to install jdk just use the official installer from Oracle
- then type in CLI: (for Windows, default install path) ```$ set %JAVA_HOME%=%programfiles%\Java\jdk1.x.y.z_bbb``` (replace x y z and bbb with version/build of your jdk)

- to install Maven get the zipped version from the net
- unzip it somewhere in your main disk, personnally i unzipped in %programfiles%\Java\
- then type in CLI: (for Windows, using chosen path) ```$ set PATH=%programfiles%\Java\apache-maven-x.y.z\bin;%PATH%```
- check if installation went correctly with ```$ mvn -v```

- type in CLI: ```
cd %userprofile%\Desktop
git clone git@github.com:krausest/js-framework-benchmark.git
cd js-framework-benchmark
npm i```

Tested only on Windows10, hope it helps.

To be continued ...

@Sharlaan
Copy link
Author

Sharlaan commented Jan 14, 2017

Now auditing build.js...

refactored build.js

const path = require('path')
const { existsSync, readdirSync, statSync } = require('fs')
const exec = require('child_process').execSync

const root = process.cwd()
npm_build_recursive(root)

console.log(`
===================================================================
\ttBuilding root folder
===================================================================`)

function npm_build_recursive(folder) {
  const has_package_json = existsSync(path.join(folder, 'package.json'))
  if (!has_package_json) return

  if (folder !== root && !/scala/.test(folder)) {
    console.log(`
===================================================================
\tBuilding ./${path.relative(root, folder)} folder
===================================================================`)

    exec('npm run build-prod', { cwd: folder, env: process.env, stdio: 'inherit' })
  }

  const subfolders = readdirSync(folder)
    .filter(subfolder => statSync(path.join(folder, subfolder)).isDirectory())
    .filter(subfolder => !/node_modules|css|dist|webdriver-java|^\./.test(subfolder))
    .map(subfolder => path.join(folder, subfolder))

  for (let subfolder of subfolders) {
    npm_build_recursive(subfolder)
  }
}
  • rimraf missing in Aurelia package.json
  • [ember-2.10beta] Not sure if it's correct to production value for both dev/prod builds ?
  "scripts": {
    ...
    "build-dev": "ember build --environment=production",
    "build-prod": "ember build --environment=production",
    ...
  },
```
  
- [Polymer-1.7] Webpack signals an error preventing build
- [React+Redux] Webpack spitted about 3 pages of warnings o.O
- [Vue-2.1] lots of warnings.

@krausest
Copy link
Owner

Thanks. I tested on a fresh Windows 10 virtual machine and the build failed for me too due to binding-scala. I moved the binding-scala out of the js-framework-benchmark folder and then npm install runs fine (including ember, bower is installed locally).
The following commands must work on the command line:

> npm
npm -version
4.0.5
> node --version
v7.4.0
> echo %JAVA_HOME% / echo $JAVA_HOME
> java -version
java version "1.8.0_111" ...
> javac
javac 1.8.0_111
> mvn -version
Apache Maven 3.3.9 (...
> git --version
git version 2.11.0.windows.3

(tsc, bower, rimraf and all other npm libraries are NOT installed)
After that I ran npm build which also worked.

Each framework must include a build-prod target which is invoked by build.js. Most frameworks have a build-dev that can be used for faster development builds. So it doesn't make a lot of sense for ember to have a build-dev, but it doesn't hurt.

Polymer indeed reports an error, but builds fine. I haven't found what causes that error and the message doesn't help me much.

@Sharlaan
Copy link
Author

strange that Ember installs worked on your windows without adding Bower in their package.json (i really search a npm install/npm i/yarn add Bower but found nowhere)

Regarding Scala yes i had to skip it out in install.js

All my cli commands for checking version works except javac, i don't know why, probably a path problem too ...

I didnot get any install problems mentioning tsc, but Aurelia build-prod definitely crashed: "clean:dist": "rimraf dist", no rimraf in dependencies. So it is surprising build-prod worked on your build without rimraf installed (i guess it were actually installed globally?)

Regarding the Ember-2.10beta build-dev, i were just noticing that both build-prod and build-dev scripts had "production" as value for their env var.
In comparison, the Ember-2.6.1 build-dev has "development" value.
But since it doesnot matter much in the building process, ok let's drop it XD

A last thing i noticed after building all and going to localhost:
it displays EXACTLY same numeric values as yours in your blog ? not even one single decimal difference, surprising isnot it, given our machines are different ? Did i miss something ?

@krausest
Copy link
Owner

Bower is a local dependency in the package.json of ember, so it should work locally.

For javac the JDK\bin-directory must be in the path, but I guess it's only binding.scala that needs java currently since webdriver-java is not built currently and webdriver-ts is prefered (I did that to get rid of all java and maven dependencies, but then binding.scala came along ;-)

rimraf is a dependency of karma and is installed in the aurelia directory. Does aurelia-v1.0.7\node_modules\rimraf exist on your machine? But I'll add it as a direct dependency which would be much better of course if used directly.

If the number are exactly the same then table.html was not updated. Results vary on my machine for each run.
If you run npm run selenium in webdriver-ts it'll create lots of files in the results dir in webdriver-ts. After that npm run results updates the table.html in the webdriver-ts directory.

@Sharlaan
Copy link
Author

Sharlaan commented Jan 15, 2017

a ok thanks, i just did npm build then npm start then went directly to localhost to check the table :S
ok ill test with npm run selenium.
Suggestion: how about adding that in end of build.js, then update npm start with
"npm run build && http-server -c-1 ."
... then add a button "Reload" to rerun the process and update table ? (= npm run selenium)

i just did another git clone, some diffs were detected but :

  • install still crashed at bindings-scala => ok i rmdir'ed it
  • next ember-2.10 beta again complained about unknown bower command ... i installed it in its package.json and rerun
    ... looks like this last problems (and the "production" instead "development" build-dev -env value) come from this commit

then npm run build went OK
(i think Polymer doesnot build because of "HTMLImports" not defined in L73 of src/main-element.html)

npm run selenium failed at .... binding-scala :S

@krausest
Copy link
Owner

bindings.scala now works an windows too.

@Sharlaan
Copy link
Author

i reinstalled repo today.
rimraf still missing in Aurelia1.0.8 (and probably other framework(s)?) => might need to add it in Aurelia's package.json ?

next with bobril:
capture

next with StemJS:
capture2

At this point i don't know what to do to continue the process ...

@krausest
Copy link
Owner

krausest commented Feb 25, 2017

I'm on holidays the next week so I can't check. I know that bobril effect and simple choose the first option (and hate that I have to do so). I checked a linux vm build on thursday and it worked, but the dependency hell is always open for surprises. If you just want to build the project simply delete the folders that cause problems and comment those frameworks in webdriver-ts/src/common.ts out.

@krausest
Copy link
Owner

Rimraf and yarn were fixed (#150). The build currently runs on Linux and OSX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants