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

WebPack on Windows #99

Closed
tomitrescak opened this issue Oct 12, 2015 · 7 comments
Closed

WebPack on Windows #99

tomitrescak opened this issue Oct 12, 2015 · 7 comments

Comments

@tomitrescak
Copy link

Due tot he unfortunate project I have to run meteor on windows.
I've decided to give the webpack spin on windows but I'm running into a lot of issues. Has anyone made this wok on Windows?

OS: Windows 7, 64bit
Node: 4.1.2
Python: 2.7.0
NPM: 3.3.6

I'm getting 404 errors ... :/ My internet IS working.

Tomi@TOMI-PC C:\Projects\Github\InstitutionsWeb\node_modules\bufferutil
> if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not f ind WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid vers ion number. [C:\Projects\Github\InstitutionsWeb\node_modules\bufferutil\build\bufferutil.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Projects\Github\In stitutionsWeb\node_modules\bufferutil\build\bufferutil.vcxproj]


gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Projects\Github\InstitutionsWeb\node_modules\bufferutil
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil Exit status 1

> utf-8-validate@1.2.1 install C:\Projects\Github\InstitutionsWeb\node_modules\utf-8-validate
> node-gyp rebuild


Tomi@TOMI-PC C:\Projects\Github\InstitutionsWeb\node_modules\utf-8-validate
> if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not f ind WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid vers ion number. [C:\Projects\Github\InstitutionsWeb\node_modules\utf-8-validate\build\validation.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Projects\Github\In stitutionsWeb\node_modules\utf-8-validate\build\validation.vcxproj]


gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Projects\Github\InstitutionsWeb\node_modules\utf-8-validate
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:utf-8-validate utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate Exit status 1
meteor-webpack-react@0.0.1 C:\Projects\Github\InstitutionsWeb

Any idea?

I have zilch experience on windows.

@jedwards1211
Copy link
Owner

That's a bummer, it sounds like you'll have to slog through some issues unfortunately (nodejs/node-gyp#629). From the console output though it looks like maybe you need to install the Windows SDK. One user in the aforementioned issue said the following worked for him:

Just did it on fresh Windows 8.1 without installing any VS!!! ⭐

Installed:

Node.js v 0.12.7
npm 3.2.0
Python 2.7.9
VC++ compiler for python 2.7
MS build tools 2013
SDK for Windows 8.1
SDK for Windows 7 with SP1
Finally go to Start -> All Programs -> Microsoft Windows SDK v7.1 -> Windows SDK 7.1 Command Prompt
No need to set PATH, msvs_version and other "magic" things...

Packages browser-sync and socket.io installed successfully. Snapshot created.

Now I want to find a minimum set of libraries which make it works.

@tomitrescak
Copy link
Author

I'm already a second day on the issue. After one full day I've decided to drop the direct windows compilation and turn my attention to Docker. I've managed to create a nice Docker image tomitrescak/meteor-webpack that runs very nice on Mac and Linux and partially in Windows ... :/ In windows all works well, when files are mounted inside the docker image. The moment you try to run the project from the mounted windows partition a whole new shitstorm breaks loose with symbolic links. I've posted question on stackoverflow, hoping that someone can help to resolve the issue.

If you want to test the image this is how you run it:

docker run -i -t -p 8080:3000 -p 9090:9090 -v="$(pwd)":/home/app --link mongo-main:mongo -w="/home/app" tomitrescak/meteor-webpack

You have to be running another docker instance with mongo named mongo-main where you will store your data.

@tomitrescak
Copy link
Author

BTW this is the error on shelljs:

npm ERR! Linux 4.0.9-boot2docker
npm ERR! argv "/opt/nodejs/bin/node" "/usr/bin/npm" "install" "shelljs"
npm ERR! node v4.1.2
npm ERR! npm  v2.14.4
npm ERR! path ../shelljs/bin/shjs
npm ERR! code EPROTO
npm ERR! errno -71
npm ERR! syscall symlink

npm ERR! EPROTO: protocol error, symlink '../shelljs/bin/shjs' -> '/home/app/meteor-webpack-react/node_modules/.bin/shjs'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Linux 4.0.9-boot2docker
npm ERR! argv "/opt/nodejs/bin/node" "/usr/bin/npm" "install" "shelljs"
npm ERR! node v4.1.2
npm ERR! npm  v2.14.4
npm ERR! path npm-debug.log.907b6eb81436ba935104c98d206fb37c
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename

npm ERR! ETXTBSY: text file is busy, rename 'npm-debug.log.907b6eb81436ba935104c98d206fb37c' -> 'npm-debug.log'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/app/meteor-webpack-react/npm-debug.log

@tomitrescak tomitrescak changed the title Web pack on Windows WebPack on Windows Oct 13, 2015
@tomitrescak
Copy link
Author

Hello. I got a bit further. I've moved the webpack files into the container, and am attaching only a meteor and app directory and it works! I am able to modify the files from within the host system ... but ... unfortunately these changes are not picked up by webpack and I have to restart the server to apply these changes. Any ide on why is this happening? Thanks!

@tomitrescak
Copy link
Author

Just posting on my progress ;)
I'm officially giving up on Windows at this stage.

I installed a fresh copy of Windows with VS 2015 and latest node and npm. EVERYTHING compiled correctly, no errors, life is peachy.

But, for some reason only prod version works and dev is stuck on loading. I am sure it has something to do with 9090 app not working, but I have no idea where to start to look for errors as console is mute. Thanks for the patience.

@tomitrescak
Copy link
Author

Dears, I have to reopen this issue as I really need to make this work on windows.
With VS 2015 the installation comes through nicely, no errors whatsoever.
The webpack loads correctly .. life is good.

The problem is, that dev is stuck on loading. Any idea what can be the issue?

@tomitrescak
Copy link
Author

HA! Nevermind .. got it ;) It was the problem of loadClientBundle.html file was created as a soft link on windows, what does not work. I disabled the creation of the linked file, copied the file there manually, and application started correctly.

Also the devProps had to be changed to var host = 'localhost'; in order to make hot reload works. IF you want, you can make this part of your documentation.

Closing. Thanks!

List:

  1. Needed Windows + Visual Studio 2015 Community Edition with C++ (9 GB, but works ... :/)
  2. Put project as much to root directory as possible to avoid the 256 path length limit (or try to use NPM3 with flatter structure)
  3. Do NPM install, make sure there are no errors
  4. Comment this line in "dev.js" // ln('-sf', loadClientBundleHtml, loadClientBundleLink);
  5. Copy the loadClientBundle.html into meteor directory (make sure to delete it with production builds)
  6. Change var host = '0.0.0.0 to var host = 'localhost in devProps.js

Life is good

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

2 participants