tlrobinson / narwhal

[DEPRECATED] A JavaScript standard library, package manager, and more.
http://narwhaljs.org/
372 stars 16 forks source link

Tusk init uses chmod Which Fails on Windows #70

Open pnewhook opened 15 years ago

pnewhook commented 15 years ago

I'm trying to setup Narwhal on windows using the directions from http://narwhaljs.org/quick-start.html but I run into a problem when I try to run tusk init hello-web Here are my steps:

  1. Clone git://github.com/280North/narwhal.git to C:\gited\narwhal
  2. Add C:\gited\narwhal\bin to my path
  3. cd to C:\gited
  4. run "narwhal.cmd narwhal\examples\hello" this returns "Hello, World!"
  5. run "narwhal.cmd narwhal\examples\narwhal" I see the narwhal, very pretty.
  6. still following the quick start guide i run "narwhal --help" this gets the listing of narwhal commands
  7. I then run "tusk init hello-web" This is where things start to go wrong.

the following directory structure is created at C:\gmosx

hello-web
  tusk
   bin
     sea
   lib

but I get the following error

org.mozilla.javascript.WrappedException: Wrapped java.io.IOException: 
Cannot run program "chmod": CreateProcess error=2, 
The system cannot find the file specified (C:\Gited\narwhal\engines \rhino\lib\os-engine.js#48) 
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1776) 
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:183) 
at org.mozilla.javascript.NativeJavaMethod.call (NativeJavaMethod.java:247) 
at org.mozilla.javascript.Interpreter.interpretLoop (Interpreter.java:1688) 
at script(C:\Gited\narwhal\engines\rhino\lib\os-engine.js:48) 
at script(C:\Gited\narwhal\engines\rhino\lib\os-engine.js:58) 
at script(C:\Gited\narwhal\lib\os.js:23) 
at script(C:\Gited\narwhal\engines\rhino\lib\file-engine.js: 123) 
at script(C:\Gited\narwhal\lib\file.js:603) 
at script(C:\Gited\narwhal\lib\narwhal\tusk\init.js:35) 
at script(C:\Gited\narwhal\lib\args.js:99) 
at script(C:\Gited\narwhal\lib\args.js:474) 
at script(C:\Gited\narwhal\lib\narwhal\tusk.js:163) 
at script(\C:\Gited\narwhal\bin\tusk:2) 
at script(C:\Gited\narwhal\bin\../lib/sandbox.js:250) 
at script(narwhal.js:209) 
at org.mozilla.javascript.Interpreter.interpret (Interpreter.java:845) 
at org.mozilla.javascript.InterpretedFunction.call (InterpretedFunction.java:164) 
at org.mozilla.javascript.optimizer.OptRuntime.callName (OptRuntime.java:97) 
at org.mozilla.javascript.gen.C__Gited_narwhal_engines_rhino_bin____bootstrap_ js_1._c_anonymous_1 (Unknown Source ) 
at org.mozilla.javascript.gen.C__Gited_narwhal_engines_rhino_bin____bootstrap_ js_1.call (Unknown Source) 
at org.mozilla.javascript.optimizer.OptRuntime.call2 (OptRuntime.java:76) 
at org.mozilla.javascript.gen.C__Gited_narwhal_engines_rhino_bin____bootstrap_ js_1._c_script_0 (Unknown Source) 
at org.mozilla.javascript.gen.C__Gited_narwhal_engines_rhino_bin____bootstrap_ js_1.call (Unknown Source) 
at org.mozilla.javascript.ContextFactory.doTopCall (ContextFactory.java:405) 
at org.mozilla.javascript.ScriptRuntime.doTopCall (ScriptRuntime.java:3066) 
at org.mozilla.javascript.gen.C__Gited_narwhal_engines_rhino_bin____bootstrap_ js_1.call (Unknown Source) 
at org.mozilla.javascript.gen.C__Gited_narwhal_engines_rhino_bin____bootstrap_ js_1.exec (Unknown Source) 
at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:563) 
at org.mozilla.javascript.tools.shell.Main.processFileSecure (Main.java:485) 
at org.mozilla.javascript.tools.shell.Main.processFile (Main.java:451) 
at org.mozilla.javascript.tools.shell.Main.processSource (Main.java:443) 
at org.mozilla.javascript.tools.shell.Main.processFiles (Main.java:196) 
at org.mozilla.javascript.tools.shell.Main$IProxy.run (Main.java:117) 
at org.mozilla.javascript.Context.call(Context.java:517) t org.mozilla.javascript.ContextFactory.call (ContextFactory.java:514) 
at org.mozilla.javascript.tools.shell.Main.exec(Main.java:179) 
at org.mozilla.javascript.tools.shell.Main.main(Main.java:157) 
Caused by: java.io.IOException: Cannot run program "chmod": 
CreateProcess error=2, The system cannot find the file specified 
at java.lang.ProcessBuilder.start(Unknown Source) 
at java.lang.Runtime.exec(Unknown Source) 
at java.lang.Runtime.exec(Unknown Source) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) 
... 24 more 
Caused by: java.io.IOException: CreateProcess error=2, The system 
cannot find the file specified 
at java.lang.ProcessImpl.create(Native Method) 
at java.lang.ProcessImpl.<init>(Unknown Source) 
at java.lang.ProcessImpl.start(Unknown Source) 
... 32 more 

Now I know almost nothing about Linux but I do understand that chmod is a permission thing. I looked into narwhal\lib\narwhal\tusk\init.js and saw the only mention of chmod is on line line 35 where it says

sea.chmod(0755); 
kriskowal commented 15 years ago

This should work-around the problem http://github.com/kriskowal/narwhal/commit/739f6ccc66f621cf60b3e23c20e357878cd628b1 Please let us know if that fixes the issue.

pnewhook commented 15 years ago

i'll have to resolve issue 71 http://github.com/tlrobinson/narwhal/issues/#issue/71 before I can test this. I tried your work around but got

C:\Gited\narwhal\packages\jack\examples>tusk.cmd init hello-jack
require error: couldn't find "C:\Gited\narwhal\lib\narwhal\tusk.js\init"

because it's including the .js on tusk instead of using the folder