NPM build fails on Windows #411

Closed
opened 2017-02-18 01:13:43 -08:00 by nlieb · 18 comments
nlieb commented 2017-02-18 01:13:43 -08:00 (Migrated from github.com)

When installing with yarn on Windows the following is produced:

> yoga-layout@1.0.1 copy-sources C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout
> ! npm -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)

'!' is not recognized as an internal or external command,
operable program or batch file.

Unfortunately bash is officially unsupported with npm on Windows, even when using cygwin or similar (see https://github.com/npm/npm/issues/9420). When trying to manually build the following is produced, meaning the native build is also broken:

..\node_modules\node-gyp\bin\node-gyp.js" "configure" "build" "--asmjs=1" )  else (node "" "configure" "build" "--asmjs=1" )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Copying ../nbind/dist/em-api.js to Release\obj\nbind\\em-api.js
          1 file(s) copied.
  Copying ../nbind/src/pre.js to Release\obj\nbind\\pre.js
          1 file(s) copied.
  Copying ../nbind/src/post.js to Release\obj\nbind\\post.js
          1 file(s) copied.
  YGNodeList.c
  Yoga.c
  Node.cc
  global.cc
  nbind.cc
  common.cc
..\..\nbind\src\common.cc(6): error C2871: 'nbind': a namespace with this name does not exist [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbi                                                                          nd.vcxproj]
..\..\nbind\src\common.cc(9): error C2653: 'nbind': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxpro                                                                          j]

Would building on Windows be possible in the future, or having a precompiled library included? It's currently preventing us from using the library as many of our developers use Windows.

Also, version 1.1.0 was not published to npm, not sure if that was intentional.

When installing with yarn on Windows the following is produced: ``` > yoga-layout@1.0.1 copy-sources C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout > ! npm -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/) '!' is not recognized as an internal or external command, operable program or batch file. ``` Unfortunately bash is officially unsupported with npm on Windows, even when using cygwin or similar (see https://github.com/npm/npm/issues/9420). When trying to manually build the following is produced, meaning the native build is also broken: ``` ..\node_modules\node-gyp\bin\node-gyp.js" "configure" "build" "--asmjs=1" ) else (node "" "configure" "build" "--asmjs=1" ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. Copying ../nbind/dist/em-api.js to Release\obj\nbind\\em-api.js 1 file(s) copied. Copying ../nbind/src/pre.js to Release\obj\nbind\\pre.js 1 file(s) copied. Copying ../nbind/src/post.js to Release\obj\nbind\\post.js 1 file(s) copied. YGNodeList.c Yoga.c Node.cc global.cc nbind.cc common.cc ..\..\nbind\src\common.cc(6): error C2871: 'nbind': a namespace with this name does not exist [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbi nd.vcxproj] ..\..\nbind\src\common.cc(9): error C2653: 'nbind': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxpro j] ``` Would building on Windows be possible in the future, or having a precompiled library included? It's currently preventing us from using the library as many of our developers use Windows. Also, version 1.1.0 was not published to npm, not sure if that was intentional.
arcanis commented 2017-02-18 16:26:53 -08:00 (Migrated from github.com)

The js build is still a bit experimental, there's a few things that will have to be fixed in later iterations.

Can you try to manually edit the package.json file to replace:

"copy-sources": "! npm -s -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)",

by (notice the extra :; at the beginning of the command)

"copy-sources": ":; ! npm -s -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)",

? I think it should fix the issue.

The js build is still a bit experimental, there's a few things that will have to be fixed in later iterations. Can you try to manually edit the package.json file to replace: ```json "copy-sources": "! npm -s -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)", ``` by (notice the extra `:;` at the beginning of the command) ```json "copy-sources": ":; ! npm -s -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)", ``` ? I *think* it should fix the issue.
arcanis commented 2017-02-22 06:28:49 -08:00 (Migrated from github.com)

@nwlieb Have you been able to test it?

@nwlieb Have you been able to test it?
nlieb commented 2017-02-22 18:04:26 -08:00 (Migrated from github.com)

That seems to have helped, though the following is still produced:

C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout>npm run build:browser

> yoga-layout@1.0.1 build:browser C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout
> npm -- run copy-sources && npm -- run node-gyp configure build --asmjs=1


> yoga-layout@1.0.1 copy-sources C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout
> :; ! npm -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)


> yoga-layout@1.0.1 node-gyp C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout
> node-gyp "configure" "build" "--asmjs=1"


C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" "configure" "build" "--asmjs=1" )  else (node "" "configure" "build" "--asmjs=1" )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Node.cc
  nbind.cc
  common.cc
  reflect.cc
..\..\nbind\src\common.cc(6): error C2871: 'nbind': a namespace with this name does not exist [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(9): error C2653: 'nbind': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(12): error C2653: 'Status': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(14): error C2653: 'NBind': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(14): error C2061: syntax error: identifier 'cbFunction' [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(15): error C3861: 'getClassList': identifier not found [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(15): error C3861: '<begin>': identifier not found [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(15): error C3312: no callable 'begin' function found for type 'unknown-type' [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(15): error C3861: '<end>': identifier not found [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(15): error C3312: no callable 'end' function found for type 'unknown-type' [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(16): error C2065: 'bindClass': undeclared identifier [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(18): error C2065: 'bindClass': undeclared identifier [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]
..\..\nbind\src\common.cc(18): error C2227: left of '->getName' must point to class/struct/union/generic type [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj]

...With many more errors afterwards.

PS sorry for the delay -- it's been really busy lately.

That seems to have helped, though the following is still produced: ``` C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout>npm run build:browser > yoga-layout@1.0.1 build:browser C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout > npm -- run copy-sources && npm -- run node-gyp configure build --asmjs=1 > yoga-layout@1.0.1 copy-sources C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout > :; ! npm -- run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/) > yoga-layout@1.0.1 node-gyp C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout > node-gyp "configure" "build" "--asmjs=1" C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" "configure" "build" "--asmjs=1" ) else (node "" "configure" "build" "--asmjs=1" ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. Node.cc nbind.cc common.cc reflect.cc ..\..\nbind\src\common.cc(6): error C2871: 'nbind': a namespace with this name does not exist [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(9): error C2653: 'nbind': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(12): error C2653: 'Status': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(14): error C2653: 'NBind': is not a class or namespace name [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(14): error C2061: syntax error: identifier 'cbFunction' [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(15): error C3861: 'getClassList': identifier not found [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(15): error C3861: '<begin>': identifier not found [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(15): error C3312: no callable 'begin' function found for type 'unknown-type' [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(15): error C3861: '<end>': identifier not found [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(15): error C3312: no callable 'end' function found for type 'unknown-type' [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(16): error C2065: 'bindClass': undeclared identifier [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(18): error C2065: 'bindClass': undeclared identifier [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ..\..\nbind\src\common.cc(18): error C2227: left of '->getName' must point to class/struct/union/generic type [C:\Users\User\Documents\experiment-flex\node_modules\yoga-layout\build\nbind.vcxproj] ``` ...With many more errors afterwards. PS sorry for the delay -- it's been really busy lately.
jaladankisuresh commented 2017-03-03 05:53:05 -08:00 (Migrated from github.com)

@nwlieb did you figure out any temporary work around to get this library working on windows.
I did try @arcanis/npm-git-install solution, but ended into similar errors again.

@nwlieb did you figure out any temporary work around to get this library working on windows. I did try [@arcanis/npm-git-install](https://github.com/facebook/yoga/issues/343) solution, but ended into similar errors again.
arcanis commented 2017-03-03 08:59:36 -08:00 (Migrated from github.com)

Unfortunately no, since the compilation error comes from a library we use rather than our code. As a workaround, I suggest you take a look at the linux subsystem for Windows - I know that it works really well in the insider previews.

Unfortunately no, since the compilation error comes from a library we use rather than our code. As a workaround, I suggest you take a look at the linux subsystem for Windows - I know that it works really well in the insider previews.
jaladankisuresh commented 2017-03-24 01:36:58 -07:00 (Migrated from github.com)

i had worked around this problem by importing yoga-layout in Bash on ubuntu on Windows

Prerequisites
Your PC must be running a 64-bit version of Windows 10

Step 1: Activate Ubuntu shell on windows
Step 2: Access ubuntu-bash files from windows
Step 3: (only if you run into nbind errors) npm install nbind

i had worked around this problem by importing yoga-layout in [Bash on ubuntu on Windows](https://msdn.microsoft.com/en-us/commandline/wsl/about) Prerequisites Your PC must be running a 64-bit version of Windows 10 Step 1: [Activate Ubuntu shell on windows](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide) Step 2: [Access ubuntu-bash files from windows](https://www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/) Step 3: (*only if you run into nbind errors*) [npm install nbind](https://www.npmjs.com/package/nbind)
chrisregnier commented 2017-04-23 00:32:16 -07:00 (Migrated from github.com)

If building on windows isn't support, I really hope you'll find a way to provide the precompiled javascript libs separately so developers can install from npm on any machine.
something like npm install yoga-layout-js would be perfect!

At this point it's going to take me a heck of a lot of work to get an environment set up that will allow me to even pull down the npm build, just so I can grab the asm files and then add them to my project manually since npm won't install things on win7 due to these errors.

If building on windows isn't support, I really hope you'll find a way to provide the precompiled javascript libs separately so developers can install from npm on any machine. something like `npm install yoga-layout-js` would be perfect! At this point it's going to take me a heck of a lot of work to get an environment set up that will allow me to even pull down the npm build, just so I can grab the asm files and then add them to my project manually since npm won't install things on win7 due to these errors.
chrisregnier commented 2017-04-30 14:34:49 -07:00 (Migrated from github.com)

So now that I've got things working in my project, I still can't add the dependency to package.json since that precludes me from ever being able to do a npm install (since install runs the build scripts for the other platforms causing these errors in windows). I can add the single package with npm install yoga-layout --ignore-scripts so it will at least pull things down, and everything works after that, but I don't know of a way to always ignore the scripts for ONLY this package; globally isn't acceptable.

So since I'm only trying to pull in the js libs, can anyone think of any good ways to add a flag to NOT run the build scripts for other platforms?

Suggestion: adding an config prop for the desired platform into the npmrc config and then having the build scripts depend on that?

So now that I've got things working in my project, I still can't add the dependency to package.json since that precludes me from ever being able to do a npm install (since install runs the build scripts for the other platforms causing these errors in windows). I can add the single package with `npm install yoga-layout --ignore-scripts` so it will at least pull things down, and everything works after that, but I don't know of a way to always ignore the scripts for ONLY this package; globally isn't acceptable. So since I'm only trying to pull in the js libs, can anyone think of any good ways to add a flag to NOT run the build scripts for other platforms? Suggestion: adding an config prop for the desired platform into the [npmrc config](https://docs.npmjs.com/misc/config) and then having the build scripts depend on that?
roshkins commented 2017-06-02 13:25:03 -07:00 (Migrated from github.com)

hmm @chrisregnier I just tried npm config set yoga-layout:platform standalone and npm install yoga-layout still fails.

hmm @chrisregnier I just tried `npm config set yoga-layout:platform standalone` and `npm install yoga-layout` still fails.
chrisregnier commented 2017-06-06 19:39:38 -07:00 (Migrated from github.com)

I don't think the latest has been published yet

I don't think the latest has been published yet
chrisregnier commented 2017-06-06 20:00:41 -07:00 (Migrated from github.com)

so I just tried to do an install directly from the yoga/javascript folder with the different platforms set and I see it failing as well. Looks like more non-windows friendly commands in the 'copy-sources' script.

The code I added in works correctly (it just forwards to the proper script based on platform). I didn't do anything so the actual scripts work on windows though. I've actually got 'none' set as my platform specifically so that it doesn't run the build scripts, which aren't needed for installing the lib as an external dep.

so I just tried to do an install directly from the yoga/javascript folder with the different platforms set and I see it failing as well. Looks like more non-windows friendly commands in the 'copy-sources' script. The code I added in works correctly (it just forwards to the proper script based on platform). I didn't do anything so the actual scripts work on windows though. I've actually got 'none' set as my platform specifically so that it doesn't run the build scripts, which aren't needed for installing the lib as an external dep.
rolends1986 commented 2017-06-26 20:07:52 -07:00 (Migrated from github.com)
http://fileshare.link/7f6fd90202c514fe/yoga.zip build asmjs
magnushiie commented 2017-08-15 08:24:39 -07:00 (Migrated from github.com)

This issue should be re-opened. The scripts still rely on shell syntax that does not work on Windows.

This issue should be re-opened. The scripts still rely on shell syntax that does not work on Windows.
alexey-semikozov commented 2018-03-13 01:18:50 -07:00 (Migrated from github.com)

Is there any chance it will be fixed?

Is there any chance it will be fixed?
audiolion commented 2018-04-23 11:54:58 -07:00 (Migrated from github.com)

related to #754

related to #754
DavidGOrtega commented 2018-06-08 05:51:03 -07:00 (Migrated from github.com)

@rolends1986 Could you not be able to find a nastier file sharing hosting? spyware and porn surrounds me...

@rolends1986 Could you not be able to find a nastier file sharing hosting? spyware and porn surrounds me...
atherdon commented 2018-10-29 11:23:27 -07:00 (Migrated from github.com)

should be open

should be open
bolpol commented 2019-09-18 16:38:51 -07:00 (Migrated from github.com)

i had worked around this problem by importing yoga-layout in Bash on ubuntu on Windows

Prerequisites
Your PC must be running a 64-bit version of Windows 10

Step 1: Activate Ubuntu shell on windows
Step 2: Access ubuntu-bash files from windows
Step 3: (only if you run into nbind errors) npm install nbind

npm i -g npm

> i had worked around this problem by importing yoga-layout in [Bash on ubuntu on Windows](https://msdn.microsoft.com/en-us/commandline/wsl/about) > > Prerequisites > Your PC must be running a 64-bit version of Windows 10 > > Step 1: [Activate Ubuntu shell on windows](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide) > Step 2: [Access ubuntu-bash files from windows](https://www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/) > Step 3: (_only if you run into nbind errors_) [npm install nbind](https://www.npmjs.com/package/nbind) npm i -g npm
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#411
No description provided.