HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

Unable to run Kevoree Hello World #86

Closed magnustellu closed 8 years ago

magnustellu commented 8 years ago

On Windows, using Git Bash.

Failed to run grunt kevoree after generating a hello world project using Yeoman. This is copy/paste of the command line:

Magnus@EKSE-WORK /C/development/heads-git/training/2.Kevoree_Basics/1.HelloWorld/js/test (master)
$ grunt kevoree
Running "kevoree" task
10:31:37  ALL    KevoreeLogger    Set logLevel= debug
>> Platform node name: node0
>> Bootstrap script: kevs\main.kevs
10:31:37  DEBUG  NPMResolver      modulesPath= c:\development\heads-git\training\2.Kevoree_Basics\1.HelloWorld\js\test\.deploy_units\node0
Fatal error: spawn ENOENT
maxleiko commented 8 years ago

To get a verbose output, you can add --stack to the grunt kevoree command

maxleiko commented 8 years ago

Did you install the latest Yeoman generator ?

npm i -g generator-kevoree@latest

If your "test" directory is an old project, you might want to update the generator, re-generate a more up-to-date project, and then run it.

magnustellu commented 8 years ago

I created an empty folder, test2. Here is what I did:

Magnus@EKSE-WORK /C/development/heads-git/training/2.Kevoree_Basics/1.HelloWorld/js/test2 (master)
$ yo kevoree

Kevoree Project Generator:

[?] Would you like to start from an existing TypeDefinition from the Kevoree Registry? No
[?] What kind of entity would you like to create? Component
[?] Choose a name for this entity? (Java camel case naming convention) HelloWorld
[?] Choose a package name for your module? (i.e my.package.name) my.package
[?] Choose your NPM module name: kevoree-comp-helloworld
[?] Do you want this to be runnable by the browser runtime? No
[?] What is the license of your module? MIT
[?] Who is the author of your module? aklmdfasø
[?] Give a description of your module: askdmlasdm
   create package.json
   create README.md
   create .npmignore
   create .gitignore
   create Gruntfile.js
   create kevs/main.kevs
   create lib/HelloWorld.js

I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.

npm WARN package.json kevoree-comp-helloworld@1.0.0 No repository field.
bower                           ENOENT No bower.json present
/
> kevoree-comp-helloworld@1.0.0 prepublish c:\development\heads-git\training\2.Kevoree_Basics\1.HelloWorld\js\test2
> grunt

Running "build" task

Running "kevoree_genmodel:main" (kevoree_genmodel) task
Package:         my.package
TypeDefinition:  HelloWorld
Version:         1.0.0
DeployUnit:      kevoree-comp-helloworld
Dictionary:      [ yourAttrName:STRING ("aDefaultValue") ]

Model generation done
Model 'kevlib.json' saved at kevlib.json

Done, without errors.
grunt@0.4.5 node_modules\grunt
├── dateformat@1.0.2-1.2.3
├── which@1.0.9
├── eventemitter2@0.4.14
├── getobject@0.1.0
├── colors@0.6.2
├── rimraf@2.2.8
├── async@0.1.22
├── grunt-legacy-util@0.2.0
├── hooker@0.2.3
├── exit@0.1.2
├── nopt@1.0.10 (abbrev@1.0.7)
├── minimatch@0.2.14 (sigmund@1.0.1, lru-cache@2.7.0)
├── glob@3.1.21 (inherits@1.0.2, graceful-fs@1.2.3)
├── lodash@0.9.2
├── coffee-script@1.3.3
├── underscore.string@2.2.1
├── iconv-lite@0.2.11
├── findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.2)
├── js-yaml@2.0.5 (argparse@0.1.16, esprima@1.0.4)
└── grunt-legacy-log@0.1.2 (grunt-legacy-log-utils@0.1.1, underscore.string@2.3.3, lodash@2.4.2)

grunt-kevoree-genmodel@2.0.0 node_modules\grunt-kevoree-genmodel
└── kevoree-gen-model@2.0.10 (kevoree-kotlin@1.0.3, chalk@0.5.1, optimist@0.6.1, kevoree-library@5.0.9)

kevoree-entities@8.0.8 node_modules\kevoree-entities
├── pseudoclass@1.0.3
├── kevoree-commons@2.2.0 (chalk@0.4.0)
├── kevoree-kevscript@2.2.3 (waxeye@0.8.1, kevoree-kotlin@1.0.3, async@0.9.2, semver@4.3.6, chalk@0.5.1, optimist@0.6.1, kevoree-registry-client@2.2.2
)
└── kevoree-library@5.0.9 (kevoree-kotlin@1.0.3)

grunt-kevoree-registry@2.0.2 node_modules\grunt-kevoree-registry
├── kevoree-registry-client@2.2.2 (minimist@1.2.0, chalk@0.5.1)
└── kevoree-library@5.0.9 (kevoree-kotlin@1.0.3)

grunt-kevoree@5.7.0 node_modules\grunt-kevoree
├── async@1.5.0
├── kevoree-commons@2.2.0 (chalk@0.4.0, pseudoclass@1.0.3)
├── serve-static@1.10.0 (escape-html@1.0.2, parseurl@1.3.0, send@0.13.0)
├── express@4.13.3 (escape-html@1.0.2, merge-descriptors@1.0.0, array-flatten@1.1.1, cookie@0.1.3, utils-merge@1.0.0, cookie-signature@1.0.6, fresh@0.
3.0, range-parser@1.0.3, methods@1.1.1, vary@1.0.1, path-to-regexp@0.1.7, etag@1.7.0, content-type@1.0.1, parseurl@1.3.0, content-disposition@0.5.0, d
epd@1.0.1, on-finished@2.3.0, qs@4.0.0, finalhandler@0.4.0, debug@2.2.0, proxy-addr@1.0.8, accepts@1.2.13, send@0.13.0, type-is@1.6.9)
├── exec-npm-install@1.0.4 (latest-version@1.0.1)
├── kevoree-resolvers@3.3.0 (exec-npm@2.0.0, mkdirp@0.5.1, latest-version@2.0.0)
├── kevoree-library@5.0.9 (kevoree-kotlin@1.0.3)
├── kevoree-kevscript@3.1.0 (waxeye@0.8.1, kevoree-kotlin@1.0.3, shortid@2.2.4, async@0.9.2, pseudoclass@1.0.3, kevoree-registry-client@2.2.2, semver@
4.3.6, optimist@0.6.1, chalk@0.5.1)
└── npm@2.14.9

Magnus@EKSE-WORK /C/development/heads-git/training/2.Kevoree_Basics/1.HelloWorld/js/test2 (master)
$ grunt kevoree --stack
Running "kevoree" task
10:50:51  ALL    KevoreeLogger    Set logLevel= debug
>> Platform node name: node0
>> Bootstrap script: kevs\main.kevs
10:50:51  DEBUG  NPMResolver      modulesPath= c:\development\heads-git\training\2.Kevoree_Basics\1.HelloWorld\js\test2\.deploy_units\node0
Fatal error: spawn ENOENT
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)
maxleiko commented 8 years ago

Do you have npm in your PATH ?

magnustellu commented 8 years ago

I have installed the latest Yeoman before I tried this. Running with kevoreejs does not work either.

Magnus@EKSE-WORK /C/development/heads-git/training/2.Kevoree_Basics/1.HelloWorld/js/test2 (master)
$ kevoreejs -n jsNode --kevscript=kevs/main.kevs
10:52:17  ALL    KevoreeLogger    Set logLevel= info
10:52:19  ERROR  NodeJSRuntime    Unable to load Kevoree KevScript: Unable to find "my.package.HelloWorld" in current model nor on Kevoree registry.
10:52:19  ERROR  NodeJSRuntime    Platform shut down.
maxleiko commented 8 years ago

It looks like Kevoree cannot spawn a child process because it cannot find the npm executable in the PATH.

magnustellu commented 8 years ago

Yes, npm is in PATH

maxleiko commented 8 years ago

Can you push your example, so I can have a look at it ?

magnustellu commented 8 years ago

Sure, I could, but I have not done anything but create a new project using Yeoman in an empty folder. Knut Eilif got the same issue following the same steps.

brice-morin commented 8 years ago

Note that I have a similar problem with the smart NPM stuff under Windows. It works with Linux, though.

magnustellu commented 8 years ago

Pushed it under training/2.Kevoree_Basics/6.Contrib/Tellu/YeomanTest

maxleiko commented 8 years ago

Ok, so I've made some investigation, and it looks like a Node.js bug on the Windows platform. https://github.com/nodejs/node-v0.x-archive/issues/5841

maxleiko commented 8 years ago

I'm gonna rollback the npm resolver to a previous version in order for Windows users to be able to run Kevoree Js.

But this trick was used to prevent npm to take too much memory. With the rollback, and so the old version, npm will still live in the same process, and so take at least 50mb of RAM if not more

maxleiko commented 8 years ago

Use grunt-kevoree@5.6.1 => modify your package.json devDependencies so that it matches:

"grunt-kevoree": "5.6.1"

Then:

rm -rf node_modules
npm i
maxleiko commented 8 years ago

You should get kevoree-nodejs-runtime@5.5.0 when the grunt-kevoree task download it. This version contains the rollbacked version of the kevoree npm resolver.

magnustellu commented 8 years ago

I think I did it correctly, but now I get:

$ grunt kevoree --stack
Running "kevoree" task
11:18:19  ALL    KevoreeLogger    Set logLevel= debug
>> Platform node name: node0
>> Bootstrap script: kevs\main.kevs
11:18:19  DEBUG  NPMResolver      modulesPath= c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\.deploy_units\node0
kevoree-nodejs-runtime@5.5.0 node_modules\grunt-kevoree\node_modules\kevoree-nodejs-runtime
├── kevoree-core@8.1.0
├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
└── kevoree-resolvers@2.2.0 (npm-vers@0.1.1)
>> Starting runtime: v5.5.0
11:18:24  INFO   KevoreeCore      Platform node name: node0
11:18:24  DEBUG  KevoreeCore      Deploy process started...
11:18:24  DEBUG  KevoreeCore      Start 'node0' bootstrapping...
Fatal error: spawn ENOENT
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)
maxleiko commented 8 years ago

Check in your node_modules/grunt-kevoree/package.json file, what version it uses. It must be 5.6.1. My bad, 5.6.1 not 5.6.2

magnustellu commented 8 years ago

The version is 5.6.2

maxleiko commented 8 years ago

Yeah, my bad, you should use 5.6.1, not 5.6.2

magnustellu commented 8 years ago

Alright, got a bit further

$ grunt kevoree --stack
Running "kevoree" task
11:31:55  ALL    KevoreeLogger    Set logLevel= debug
>> Platform node name: node0
>> Bootstrap script: kevs\main.kevs
11:31:55  DEBUG  NPMResolver      modulesPath= c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\.deploy_units\node0
kevoree-nodejs-runtime@5.5.0 node_modules\grunt-kevoree\node_modules\kevoree-nodejs-runtime
├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
└── kevoree-core@8.1.0 (async@1.5.0)
>> Starting runtime: v5.5.0
11:31:58  INFO   KevoreeCore      Platform node name: node0
11:31:58  DEBUG  KevoreeCore      Deploy process started...
11:31:58  DEBUG  KevoreeCore      Start 'node0' bootstrapping...
kevoree-node-javascript@5.2.0 .deploy_units\node0\node_modules\kevoree-node-javascript
├── times-up@1.0.1
├── async@0.9.2
├── kevoree-kotlin@1.0.3
├── pseudoclass@1.0.3
├── kevoree-commons@2.2.0 (chalk@0.4.0)
├── kevoree-library@5.0.9
└── kevoree-entities@8.0.8 (kevoree-kevscript@2.2.3)
Running "build" task

Done, without errors.
kevoree-comp-helloworld@1.0.0 .deploy_units\node0\node_modules\kevoree-comp-helloworld
└── kevoree-entities@8.0.8 (pseudoclass@1.0.3, kevoree-commons@2.2.0, kevoree-library@5.0.9, kevoree-kevscript@2.2.3)
Fatal error: Cannot find module 'c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\.deploy_units\node0\node_modules\kevore
e-comp-helloworld\kevlib.json'
Error: Cannot find module 'c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\.deploy_units\node0\node_modules\kevoree-comp
-helloworld\kevlib.json'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at PseudoClass.<anonymous> (c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\node_modules\grunt-kevoree\node_modules\
kevoree-resolvers\lib\NPMResolver.js:43:33)
    at installCallback (c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\node_modules\grunt-kevoree\node_modules\npmi\npm
i.js:102:9)
    at save (c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\node_modules\grunt-kevoree\node_modules\npm\lib\install.js:
415:12)
    at c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\node_modules\grunt-kevoree\node_modules\npm\lib\install.js:138:7
    at c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\node_modules\grunt-kevoree\node_modules\npm\lib\install.js:268:7
    at c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\node_modules\grunt-kevoree\node_modules\npm\node_modules\read-ins
talled\read-installed.js:142:5
maxleiko commented 8 years ago

Do you have the kevlib.json file in the root directory of your project ? If not, run grunt build

maxleiko commented 8 years ago

By the way, I've found a workaround, in order to run npm in a child_process as intended in Windows too. I'm gonna release that ASAP so that you do not have to use an old version of grunt-kevoree.

magnustellu commented 8 years ago

Yes, it is in the root directory.

Ok, great.

maxleiko commented 8 years ago

It works under Windows for me. Did you remove the .deploy_units folder if any ?

magnustellu commented 8 years ago

Didn't remove it at first, but tried deleting it now. Same issue as before.

magnustellu commented 8 years ago

Lunch, will be back in an hour.

maxleiko commented 8 years ago

Alright. Should be fixed.

Go get the latest everything :)
grunt-kevoree v5.8.0
Which should download the latest runtime:
kevoree-nodejs-runtime v5.6.0

Lunch time too. Tell me if anything fails.

maxleiko commented 8 years ago

If you are interested, this does the trick.

magnustellu commented 8 years ago

I deleted node_modules and .deploy_units, ran npm -i, then grunt kevoree --stack.

Do I need to do anything else to get all the latest stuff? I now get this:

$ grunt kevoree --stack
Running "kevoree" task
12:41:49  ALL    KevoreeLogger    Set logLevel= debug
>> Platform node name: node0
>> Bootstrap script: kevs\main.kevs
12:41:49  DEBUG  NPMResolver      modulesPath= c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\.deploy_units\node0
kevoree-nodejs-runtime@5.6.0 node_modules\grunt-kevoree\node_modules\kevoree-nodejs-runtime
├── kevoree-core@8.1.0
└── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
Fatal error: "grunt-kevoree" unable to link kevoree-comp-helloworld in c:\development\heads-git\training\2.Kevoree_Basics\6.Contrib\Tellu\YeomanTest\.
deploy_units\node0
magnustellu commented 8 years ago

.deploy_units is not created.

maxleiko commented 8 years ago

I'm investigating

maxleiko commented 8 years ago

Damn. There were a bunch of problems with my latest releases. Sorry for that. I've stabilize them in the latest grunt-kevoree release.
There is still a problem though, Windows does not allow symlinking without the user being the root/Administrator. That will cause problem when using the command grunt kevoree, as the new version of grunt kevoree uses symlink, to speed-up the deployment while in development.

I'll try to find a workaround for that too. But for now, you can use kevoree-js if you start your terminal as Root in Windows (right click > Run as Administrator)

magnustellu commented 8 years ago

Ok, got Hello World to work, thanks.