patrickjquinn / P-Brain.ai

Natural language virtual assistant using Node.js + Bootstrap
MIT License
342 stars 76 forks source link

Is windows compatibility broken? #31

Closed staberas closed 7 years ago

staberas commented 7 years ago

I just need a confirmation if windows version working or its broken. I Sync my 'old' version to the newest one just to realise it not working (though it starts a server but it gets stuck on the 'wait a min' bubble) and npm/yarn giving me errors

patrickjquinn commented 7 years ago

Can you paste your logs? I'll need those

staberas commented 7 years ago
Server started on http://localhost:4567
{ Error: Could not locate the bindings file. Tried:
 → C:\Users\staberas\Documents\GitHub\P-Brain.ai\P-Brain.ai\node_modules\node-ex
pat\build\node_expat.node
_..... it goes on listing the same thing  and ends....._
 → C:\Users\staberas\Documents\GitHub\P-Brain.ai\P-Brain.ai\node_modules\node-ex
pat\compiled\7.5.0\win32\x64\node_expat.node
(node:10344) DeprecationWarning: Unhandled promise rejections are deprecated. In
 the future, promise rejections that are not handled will terminate the Node.js
process with a non-zero exit code.

i have installed all dependecies python2.7 - 3 and the MS C++ other have suggested on other forums for similar bug

SuperTommetje commented 7 years ago

I'm facing the same issue. It started about two or three days ago but wanted to wait to see if it fixed itself.

patrickjquinn commented 7 years ago

Only things I can think of whilst reading this log are:

Let me know if the second method above helps any, ill test it on my local windows rig.

staberas commented 7 years ago

Remove your node_modules folder, run yarn and then yarn start

Did that yesterday while troubleshooting. It resulted doing the same thing again will try downgrading later today from node 7 to 6 .

edit: seems i have 2 versions of nodejs and yarn loads the newer one :/

patrickjquinn commented 7 years ago

Okay, i'll be doing a big project cleanup over the next day or two so i'll make sure this issue is resolved properly. I'll comment here as soon as its done :)

timstableford commented 7 years ago

A workaround is to remove the fact skill and then the xml2json dependency in package.json.

patrickjquinn commented 7 years ago

For anyone on windows, running npm install --global --production windows-build-tools and re-issuing the yarn & yarn start commands will resolve this problem, i'll add this to the project spec .

timstableford commented 7 years ago

It might also be worth adding Python and Yarn to the dependencies section of the README.

patrickjquinn commented 7 years ago

I'll add a windows specific install section. I thought that yarn was already there, i'll add that too!

patrickjquinn commented 7 years ago

Updated both sections. Let me know if this is now resolved and I can close this ticket 👍

staberas commented 7 years ago

ok i just tried on my win10 laptop which didnt had nodejs/npm/yarn
heres a complete log

C:\Users\Staberas\Documents\GitHub\P-Brain.ai>yarn yarn install v0.19.1 info No lockfile found. warning P-Brain.ai@0.5.3: License should be a valid SPDX license expression [1/4] Resolving packages... warning ava > babel-preset-es2015-node4@2.1.1: Use npmjs.org/babel-preset-env instead, see https://github.com/babel/babel-preset-env warning tabletojson > request > tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130 warning tabletojson > request > node-uuid@1.4.7: use uuid module instead warning x-ray > x-ray-crawler > cheerio > CSSselect@0.4.1: the module is now available as 'css-select' warning x-ray > x-ray-crawler > cheerio > CSSselect > CSSwhat@0.4.7: the module is now available as 'css-what' [2/4] Fetching packages... warning fsevents@1.0.17: The platform "win32" is incompatible with this module. info "fsevents@1.0.17" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... [1/1] ⠈ node-expat: not ok [-/1] ⠈ waiting... [-/1] ⠈ waiting... [-/1] ⠈ waiting... error C:\Users\Staberas\Documents\GitHub\P-Brain.ai\node_modules\node-expat: Command failed. Exit code: 1 Command: C:\WINDOWS\system32\cmd.exe Arguments: /d /s /c node-gyp rebuild Directory: C:\Users\Staberas\Documents\GitHub\P-Brain.ai\node_modules\node-expat Output: C:\Users\Staberas\Documents\GitHub\P-Brain.ai\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\Yarn\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) gyp info it worked if it ends with ok gyp info using node-gyp@3.5.0 gyp info using node@6.9.1 | win32 | x64 gyp info spawn C:\Python27\python.exe gyp info spawn args [ 'C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'msvs', gyp info spawn args '-G', gyp info spawn args 'msvs_version=auto', gyp info spawn args '-I', gyp info spawn args 'C:\Users\Staberas\Documents\GitHub\P-Brain.ai\node_modules\node-expat\build\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Program Files (x86)\Yarn\node_modules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\Staberas\.node-gyp\6.9.1\include\node\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\Users\Staberas\.node-gyp\6.9.1', gyp info spawn args '-Dnode_gyp_dir=C:\Program Files (x86)\Yarn\node_modules\node-gyp', gyp info spawn args '-Dnode_lib_file=node.lib', gyp info spawn args '-Dmodule_root_dir=C:\Users\Staberas\Documents\GitHub\P-Brain.ai\node_modules\node-expat', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'C:\Users\Staberas\Documents\GitHub\P-Brain.ai\node_modules\node-expat\build', gyp info spawn args '-Goutput_dir=.' ] Traceback (most recent call last): File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\gyp_main.py", line 16, in sys.exit(gyp.script_main()) File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp__init.py", line 545, in script_main return main(sys.argv[1:]) File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp__init.py", line 538, in main return gyp_main(args) File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp\init.py", line 514, in gyp_main options.duplicate_basename_check) File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp\init__.py", line 130, in Load params['parallel'], params['root_targets']) File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 2778, in Load variables, includes, depth, check, True) File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 420, in LoadTargetBuildFile build_file_data, PHASE_EARLY, variables, build_file_path) File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1217, in ProcessVariablesAndConditionsInDict variables, build_file, 'variables') File "C:\Program Files (x86)\Yarn\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1228, in ProcessVariablesAndConditionsInDict 'only, found ' + expanded.class.name__ + ' for ' + key) ValueError: Variable expansion in this context permits str and int only, found long for lastUpdateCheck while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files (x86)\Yarn\node_modules\node-gyp\lib\configure.js:308:16) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Windows_NT 10.0.14393 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files (x86)\Yarn\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\Staberas\Documents\GitHub\P-Brain.ai\node_modules\node-expat gyp ERR! node -v v6.9.1 gyp ERR! node-gyp -v v3.5.0 gyp ERR! not ok info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

timstableford commented 7 years ago

Did you do the npm command to install the windows tools? If you did, maybe try with Python 3.x instead?

staberas commented 7 years ago

A workaround is to remove the fact skill and then the xml2json dependency in package.json.

can confirm this actually works . Ive tried changing to nightly yarn versions. Im currently on 0.21.0 yarn and nodejs LTS, it failed too. I took the thread from the start again and after deleting those 2 files it worked. So i guess we have to remove them if the enviroment is windows...

patrickjquinn commented 7 years ago

Actually, if you remove xml2json as a dependency, and then remove worlfram alpha from the fact skill that should be enough without losing the ability to search for facts!

timstableford commented 7 years ago

Is there a different parser we could use maybe instead of xml2json?

staberas commented 7 years ago

tested on my laptop using 7.5 nodejs & 0.19 yarn without facts skill and it works xml2json is the one that breaks the windows version.

patrickjquinn commented 7 years ago

I'm testing a xml2json alternative. I may just remove Wolframalpha.

timstableford commented 7 years ago

@patrickjquinn We should switch from xml2json to the Wolfram Alpha plugin for NodeJS. It doesn't rely on node-expat.

timstableford commented 7 years ago

Windows compatibility should be fixed in #35.

timstableford commented 7 years ago

@staberas and @SuperTommetje the fix has been merged in now, could you pull and verify the fix works for you guys?

staberas commented 7 years ago

@timstableford verified works