Bug 51743 - Не работает команда `node-gyp rebuild`
Summary: Не работает команда `node-gyp rebuild`
Status: NEW
Alias: None
Product: Sisyphus
Classification: Development
Component: node-gyp (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Vitaly Lipatov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-17 17:43 MSK by Alexander Makeenkov
Modified: 2024-10-17 17:43 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Makeenkov 2024-10-17 17:43:12 MSK
Версия пакета:
node-gyp-10.1.0-alt1

Шаги воспроизведения:
```
# apt-get install node-gyp npm node-addon-api
$ npm install bindings

$ cat > binding.gyp <<EOF
{
  "targets": [
    { 
      "cflags!": [ "-fno-exceptions" ],
      "cflags_cc!": [ "-fno-exceptions" ],
      "include_dirs" : [
        "<!@(node -p \"require('node-addon-api').include\")"
      ],
      "target_name": "hello_world",
      "sources": [ "hello_world.cc" ],
      'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
    }
  ]
}
EOF

$ cat > hello_world.cc <<EOF
#include <napi.h>

Napi::String SayHi(const Napi::CallbackInfo& info) {
  Napi::Env env = info.Env();

  return Napi::String::New(env, "Hi!");
}

Napi::Object init(Napi::Env env, Napi::Object exports) {
    exports.Set(Napi::String::New(env, "sayHi"), Napi::Function::New(env, SayHi));
    return exports;
};

NODE_API_MODULE(hello_world, init);
EOF

$ cat > main.js <<EOF
const hello_world = require('bindings')('hello_world')

console.log(hello_world.sayHi());
EOF

$ node-gyp configure
$ node-gyp build
$ node main.js
$ node-gyp rebuild
```

Получаемый результат:
```
$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.17.0 | linux | x64
gyp info find Python using Python version 3.12.7 found at "/usr/bin/python3"
gyp ERR! build error 
gyp ERR! stack Error: You must run `node-gyp configure` first!
gyp ERR! stack at loadConfigGypi (/usr/lib/node_modules/node-gyp/lib/build.js:48:15)
gyp ERR! stack at async build (/usr/lib/node_modules/node-gyp/lib/build.js:35:3)
gyp ERR! stack at async run (/usr/lib/node_modules/node-gyp/bin/node-gyp.js:81:18)
gyp ERR! System Linux 6.6.56-un-def-alt1
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/test/q
gyp ERR! node -v v20.17.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok 
```

Выполнение configure не помогает, ошибка с таким же сообщением всё равно остаётся.