speeduino / Ardu-Stim

96 stars 71 forks source link

Unable to install GUI, fails to build at "npm install" #63

Closed loopyengineeringco closed 1 year ago

loopyengineeringco commented 1 year ago

Hi guys

Unable to install the gui - tried now on my Raspbian machine, Mac laptop and Windows10 PC. Always fails at the the "npm install" stage.

npm version 9.5.1, node v18.16.1

Here's the traceback on windows:

PS C:\Users\ivesh\Ardu-Stim\UI> npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated electron-notarize@1.0.0: Please use @electron/notarize moving forward.  There is no API change, just a package name change
npm WARN deprecated asar@3.0.3: Please use @electron/asar moving forward.  There is no API change, just a package name change
npm WARN deprecated electron-osx-sign@0.5.0: Please use @electron/osx-sign moving forward. Be aware the API is slightly different
npm WARN deprecated electron-rebuild@2.3.4: Please use @electron/rebuild moving forward.  There is no API change, just a package name change
npm WARN deprecated core-js@3.8.2: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\tar-stream',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\ivesh\Ardu-Stim\UI\node_modules\tar-stream\node_modules'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\tar-stream\\node_modules'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\ivesh\Ardu-Stim\UI\node_modules\usb
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install --verbose || node-gyp rebuild
npm ERR! prebuild-install info begin Prebuild-install version 5.3.6
npm ERR! prebuild-install info install installing standalone, skipping download.
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@18.16.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.11.4 found at "C:\Users\ivesh\AppData\Local\Programs\Python\Python311\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v18.16.1/node-v18.16.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.16.1/node-v18.16.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v18.16.1/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v18.16.1/win-x64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v18.16.1/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v18.16.1/win-arm64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.16.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.16.1/win-x64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.16.1/win-x86/node.lib
npm ERR! gyp http 404 https://nodejs.org/download/release/v18.16.1/win-arm64/node.lib
npm ERR! gyp info find VS using VS2019 (16.11.33801.447) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! (node:7808) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn C:\Users\ivesh\AppData\Local\Programs\Python\Python311\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\usb\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\ivesh\\AppData\\Local\\node-gyp\\Cache\\18.16.1\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\ivesh\\AppData\\Local\\node-gyp\\Cache\\18.16.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\ivesh\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\18.16.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\usb',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\usb\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\gyp_main.py", line 51, in <module>
npm ERR!     sys.exit(gyp.script_main())
npm ERR!              ^^^^^^^^^^^^^^^^^
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 670, in script_main
npm ERR!     return main(sys.argv[1:])
npm ERR!            ^^^^^^^^^^^^^^^^^^
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 662, in main
npm ERR!     return gyp_main(args)
npm ERR!            ^^^^^^^^^^^^^^
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 629, in gyp_main
npm ERR!     [generator, flat_list, targets, data] = Load(
npm ERR!                                             ^^^^^
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 150, in Load
npm ERR!     result = gyp.input.Load(
npm ERR!              ^^^^^^^^^^^^^^^
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 3021, in Load
npm ERR!     LoadTargetBuildFile(
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 411, in LoadTargetBuildFile
npm ERR!     build_file_data = LoadOneBuildFile(
npm ERR!                       ^^^^^^^^^^^^^^^^^
npm ERR!   File "C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 239, in LoadOneBuildFile
npm ERR!     build_file_contents = open(build_file_path, "rU").read()
npm ERR!                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! ValueError: invalid mode: 'rU' while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\ivesh\Ardu-Stim\UI\node_modules\node-gyp\lib\configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ivesh\\Ardu-Stim\\UI\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\ivesh\Ardu-Stim\UI\node_modules\usb
npm ERR! gyp ERR! node -v v18.16.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ivesh\AppData\Local\npm-cache\_logs\2023-07-04T20_57_59_172Z-debug-0.log

Any ideas?

loopyengineeringco commented 1 year ago

The errors seem to be python command related, is this because I'm on python3? Current npm requires python 3, it was throwing errors when I had only 2.7 installed. Is there a way to update these commands, or install older npm? Or maybe I'm barking up a wrong tree

loopyengineeringco commented 1 year ago

I got it working 👏

tl/dr: it really does want python2, not 3.

Depending on how you install Node & npm, if it's from the official repo (https://nodejs.org/en/download/releases) it will always install Python3.11 (if you allow the additional helper script go ahead afterwards, which you probable need for the other dependencies). It'll install 3.11 even with a very old Node release, presumably it's fetching that version number from some online repo thats more up to date than the script. So I installed the oldest Node.js+npm possible (14.21.3), then uninstalled the Python3.11 that it bundled, and manually installed python2.7 from the official site🥵

It built and now runs!

loopyengineeringco commented 1 year ago

Closing