timotejroiko / sweph

The definitive Swiss Ephemeris bindings for Node.js
Other
93 stars 15 forks source link

unable to install on Windows 11 #17

Closed mephitrpg closed 6 months ago

mephitrpg commented 6 months ago

Hi, installed latest Node, Python and Build Tools for Visual Studio 2022 but npm install sweph doesn't work (tried with both Windows 10 SDK 11 and Windows 11 SDK). Here is the log. Thanks.

0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@9.7.1
2 info using node@v16.17.1
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Users\jure\AppData\Roaming\nvm\v16.17.1\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\storage\Dropbox\Dropbox\franci\birthchart\.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\jure\.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Program Files\nodejs\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 11ms
17 timing npm:load:configload Completed in 11ms
18 timing config:load:flatten Completed in 2ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 1ms
21 verbose title npm install sweph
22 verbose argv "install" "sweph"
23 timing npm:load:setTitle Completed in 1ms
24 timing npm:load:display Completed in 0ms
25 verbose logfile logs-max:10 dir:C:\Users\jure\AppData\Local\npm-cache\_logs\2024-02-15T13_21_42_109Z-
26 verbose logfile C:\Users\jure\AppData\Local\npm-cache\_logs\2024-02-15T13_21_42_109Z-debug-0.log
27 timing npm:load:logFile Completed in 9ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 53ms
31 timing config:load:flatten Completed in 0ms
32 timing arborist:ctor Completed in 1ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 2 files
35 timing idealTree:init Completed in 14ms
36 timing idealTree:userRequests Completed in 3ms
37 silly idealTree buildDeps
38 silly fetch manifest sweph@*
39 silly logfile done cleaning log files
40 http fetch GET 200 https://registry.npmjs.org/sweph 382ms (cache revalidated)
41 silly placeDep ROOT sweph@2.10.3-3 REPLACE for:  want: *
42 timing idealTree:#root Completed in 388ms
43 timing idealTree:node_modules/sweph Completed in 0ms
44 timing idealTree:buildDeps Completed in 389ms
45 timing idealTree:fixDepFlags Completed in 0ms
46 timing idealTree Completed in 407ms
47 timing reify:loadTrees Completed in 407ms
48 timing reify:diffTrees Completed in 1ms
49 silly reify mark retired [
49 silly reify   'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph'
49 silly reify ]
50 silly reify moves {
50 silly reify   'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph': 'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\.sweph-Cm7fpgpu'
50 silly reify }
51 timing reify:retireShallow Completed in 4ms
52 timing reify:createSparse Completed in 1ms
53 timing reify:loadBundles Completed in 0ms
54 timing reifyNode:node_modules/sweph Completed in 190ms
55 timing reify:unpack Completed in 190ms
56 timing reify:unretire Completed in 0ms
57 timing build:queue Completed in 14ms
58 info run sweph@2.10.3-3 preinstall node_modules/sweph node -e "const { readdirSync, readFileSync, writeFileSync } = require('fs'); const file = readdirSync('./src/functions').map((x,i) => readFileSync('./src/functions/' + x, 'utf8').replace(/args/g, 'args' + i).replace('#include <sweph.h>', '')).reduce((a,b) => a + b, '#include <sweph.h>'); writeFileSync('./src/functions.cpp', file, 'utf8');"
59 info run sweph@2.10.3-3 preinstall { code: 0, signal: null }
60 timing build:run:preinstall:node_modules/sweph Completed in 902ms
61 timing build:run:preinstall Completed in 903ms
62 info run sweph@2.10.3-3 install node_modules/sweph node-gyp rebuild && npm run test
63 info run sweph@2.10.3-3 install { code: 1, signal: null }
64 warn cleanup Failed to remove some directories [
64 warn cleanup   [
64 warn cleanup     'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph',
64 warn cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\storage\Dropbox\Dropbox\franci\birthchart\node_modules\sweph'] {
64 warn cleanup       errno: -4082,
64 warn cleanup       code: 'EBUSY',
64 warn cleanup       syscall: 'rmdir',
64 warn cleanup       path: 'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph'
64 warn cleanup     }
64 warn cleanup   ],
64 warn cleanup   [
64 warn cleanup     'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph',
64 warn cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\storage\Dropbox\Dropbox\franci\birthchart\node_modules\sweph'] {
64 warn cleanup       errno: -4082,
64 warn cleanup       code: 'EBUSY',
64 warn cleanup       syscall: 'rmdir',
64 warn cleanup       path: 'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph'
64 warn cleanup     }
64 warn cleanup   ]
64 warn cleanup ]
65 timing reify:rollback:createSparse Completed in 30ms
66 timing reify:rollback:retireShallow Completed in 4ms
67 timing command:install Completed in 6731ms
68 verbose stack Error: command failed
68 verbose stack     at ChildProcess.<anonymous> (C:\Users\jure\AppData\Roaming\nvm\v16.17.1\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:53:27)
68 verbose stack     at ChildProcess.emit (node:events:513:28)
68 verbose stack     at maybeClose (node:internal/child_process:1093:16)
68 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
69 verbose pkgid sweph@2.10.3-3
70 verbose cwd C:\storage\Dropbox\Dropbox\franci\birthchart
71 verbose Windows_NT 10.0.22631
72 verbose node v16.17.1
73 verbose npm  v9.7.1
74 error code 1
75 error path C:\storage\Dropbox\Dropbox\franci\birthchart\node_modules\sweph
76 error command failed
77 error command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild && npm run test
78 error gyp info it worked if it ends with ok
78 error gyp info using node-gyp@9.3.1
78 error gyp info using node@16.17.1 | win32 | x64
78 error gyp info find Python using Python version 3.12.2 found at "C:\Users\jure\AppData\Local\Programs\Python\Python312\python.exe"
78 error gyp info find VS using VS2022 (17.9.34607.119) found at:
78 error gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
78 error gyp info find VS run with --verbose for detailed information
78 error gyp info spawn C:\Users\jure\AppData\Local\Programs\Python\Python312\python.exe
78 error gyp info spawn args [
78 error gyp info spawn args   'C:\\Users\\jure\\AppData\\Roaming\\nvm\\v16.17.1\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
78 error gyp info spawn args   'binding.gyp',
78 error gyp info spawn args   '-f',
78 error gyp info spawn args   'msvs',
78 error gyp info spawn args   '-I',
78 error gyp info spawn args   'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph\\build\\config.gypi',
78 error gyp info spawn args   '-I',
78 error gyp info spawn args   'C:\\Users\\jure\\AppData\\Roaming\\nvm\\v16.17.1\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
78 error gyp info spawn args   '-I',
78 error gyp info spawn args   'C:\\Users\\jure\\AppData\\Local\\node-gyp\\Cache\\16.17.1\\include\\node\\common.gypi',
78 error gyp info spawn args   '-Dlibrary=shared_library',
78 error gyp info spawn args   '-Dvisibility=default',
78 error gyp info spawn args   '-Dnode_root_dir=C:\\Users\\jure\\AppData\\Local\\node-gyp\\Cache\\16.17.1',
78 error gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\jure\\AppData\\Roaming\\nvm\\v16.17.1\\node_modules\\npm\\node_modules\\node-gyp',
78 error gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\jure\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.17.1\\\\<(target_arch)\\\\node.lib',
78 error gyp info spawn args   '-Dmodule_root_dir=C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph',
78 error gyp info spawn args   '-Dnode_engine=v8',
78 error gyp info spawn args   '--depth=.',
78 error gyp info spawn args   '--no-parallel',
78 error gyp info spawn args   '--generator-output',
78 error gyp info spawn args   'C:\\storage\\Dropbox\\Dropbox\\franci\\birthchart\\node_modules\\sweph\\build',
78 error gyp info spawn args   '-Goutput_dir=.'
78 error gyp info spawn args ]
78 error Traceback (most recent call last):
78 error   File "C:\Users\jure\AppData\Roaming\nvm\v16.17.1\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 42, in <module>
78 error     import gyp  # noqa: E402
78 error     ^^^^^^^^^^
78 error   File "C:\Users\jure\AppData\Roaming\nvm\v16.17.1\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 9, in <module>
78 error     import gyp.input
78 error   File "C:\Users\jure\AppData\Roaming\nvm\v16.17.1\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 19, in <module>
78 error     from distutils.version import StrictVersion
78 error ModuleNotFoundError: No module named 'distutils'
78 error gyp ERR! configure error 
78 error gyp ERR! stack Error: `gyp` failed with exit code: 1
78 error gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\jure\AppData\Roaming\nvm\v16.17.1\node_modules\npm\node_modules\node-gyp\lib\configure.js:325:16)
78 error gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
78 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
78 error gyp ERR! System Windows_NT 10.0.22631
78 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jure\\AppData\\Roaming\\nvm\\v16.17.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
78 error gyp ERR! cwd C:\storage\Dropbox\Dropbox\franci\birthchart\node_modules\sweph
78 error gyp ERR! node -v v16.17.1
78 error gyp ERR! node-gyp -v v9.3.1
78 error gyp ERR! not ok
79 verbose exit 1
80 timing npm Completed in 11105ms
81 verbose unfinished npm timer reify 1708003306457
82 verbose unfinished npm timer reify:build 1708003307064
83 verbose unfinished npm timer build 1708003307064
84 verbose unfinished npm timer build:deps 1708003307064
85 verbose unfinished npm timer build:run:install 1708003307983
86 verbose unfinished npm timer build:run:install:node_modules/sweph 1708003307983
87 verbose code 1
88 error A complete log of this run can be found in: C:\Users\jure\AppData\Local\npm-cache\_logs\2024-02-15T13_21_42_109Z-debug-0.log
mephitrpg commented 6 months ago

Now npm install sweph works. This is what I installed:

timotejroiko commented 6 months ago

hey,

the issue is with node-gyp, which does the compilation step.

When using a node version lower that 21.3 (in your case it was node 16), only python 3.11 works.

Python 3.12 had a breaking change where they removed a component that was used by node-gyp. An update to fix it was released only in node v21.3+ i think.

And as far as i know, node-gyp still doesnt support windows 11 SDK, thats why windows 10 SDK is needed.