jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Latest Jake does not work on windows 10 #365

Closed cmdematos closed 4 years ago

cmdematos commented 4 years ago

I have had Jake installed globally on my Windows 10 development workstation for about 2 years. I recently upgraded wich broke the tool. This issue may be related to node or npm, I am using node v12.6.0 and npm 6.9.0 and jake 10.3.2 on Windows 10 version 1909 build# 18363.479

Jake is installed globally via npm install -g jake

Two major issues:

1) After installing Jake won't run at all with the following error:

jake aborted.
Error: Cannot find module 'jake'
Require stack:
- C:\Development\devops\docker-images\corebase\files\jakelib\env.js
- C:\Users\cmdem\AppData\Roaming\npm\node_modules\jake\lib\loader.js
- C:\Users\cmdem\AppData\Roaming\npm\node_modules\jake\lib\jake.js
- C:\Users\cmdem\AppData\Roaming\npm\node_modules\jake\bin\cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (C:\Development\devops\docker-images\corebase\files\jakelib\env.js:1:35)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19)

To solve this problem we must set NODE_PATH environment variable to %USEERPROFILE%\AppData\Roaming\npm

2) After setting this variable jake modules are resolved, but somehow the system thinks we are running a Unix OS maybe. It seems to try to load and run a shell script instead of a windows batch command...

jake aborted.
c:\Users\cmdem\AppData\Roaming\npm\jake:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at Module._compile (internal/modules/cjs/loader.js:720:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (C:\Development\devops\docker-images\corebase\files\jakelib\env.js:1:35)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)

Whatever the issue, this type of problem has been reported on multiple npm modules, this may be occurring on a dependency of Jake. This seems to be an easy to repeat issue because reports of this error seem to affect many different npm modules, always on Windows.

Whatever the issue is, it can be worked around by installing jake locally instead of globally.

Off-course this used to work so it marks a regression in quality and portability. I just dont have the bandwidth to resolve it at this time, I would rather submit a fix than this issue.

mde commented 4 years ago

I cannot repro your issue. Here are the steps I went through:

I am using VirtualBox 6.0.14 for virtualization. I downloaded a Window 10 VM from Microsoft, here:

https://developer.microsoft.com/en-us/windows/downloads/virtual-machines

I started up the VM, went to the NodeJS Web site in the MS Edge browser, and downloaded the latest Node LTS (currently v12.13.1) and installed the MSI.

I then opened the Command Prompt application, and verified that Node was installed and working, which it was:

Screen Shot 2019-11-28 at 11 28 45

I then created a test directory in Documents (thinking I would have to do a local install too), and after verifying the version of NPM, I did a global install of Jake:

Screen Shot 2019-11-28 at 11 28 19

As you can see, once it was globally installed, it was available as a global CLI tool with no special work or effort.

I'm not sure what particular things are different about your environment, but in the case of a normal (MS-supplied) Windows 10 image, a stock install of Node LTS, and a normal global NPM-install of Jake, everything works as expected.

I am going to close this issue. Feel free to reopen if you need my further assistance to troubleshoot your particular problems, but this does not appear to be a general regression.