<p>node-pty no se basa en el nodo 12 (V8 7.4)</p>

Creado en 24 abr. 2019  ·  13Comentarios  ·  Fuente: microsoft/node-pty

Detalles del entorno

  • SO: macOS
  • Versión del SO: 10.14.3
  • versión de node-pty: 0.8.1

Descripcion del problema

En el nodo 10, vimos avisos de obsolescencia durante la compilación, pero node-pty aún funcionó.

A partir del lanzamiento de hoy del Nodo 12, node-pty ya no se compila.

Intentaré actualizar y enviar un PR si tengo suerte.

21:29 $ npm i [email protected]

> [email protected] install /Users/mogden/repos/github.com/machellerogden/node-pty-test/node_modules/node-pty
> node scripts/install.js

  CXX(target) Release/obj.target/pty/src/unix/pty.o
In file included from ../src/unix/pty.cc:20:
In file included from ../../nan/nan.h:222:
In file included from ../../nan/nan_converters.h:67:
../../nan/nan_converters_43_inl.h:22:1: warning: 'ToBoolean' is deprecated: ToBoolean can never throw. Use Local version. [-Wdeprecated-declarations]
X(Boolean)
^
../../nan/nan_converters_43_inl.h:18:12: note: expanded from macro 'X'
      val->To ## TYPE(isolate->GetCurrentContext())                            \
           ^
<scratch space>:23:1: note: expanded from here
ToBoolean
^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2523:3: note: 'ToBoolean' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("ToBoolean can never throw. Use Local version.",
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:322:29: note: expanded from macro 'V8_DEPRECATE_SOON'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/unix/pty.cc:20:
In file included from ../../nan/nan.h:222:
In file included from ../../nan/nan_converters.h:67:
../../nan/nan_converters_43_inl.h:40:1: warning: 'BooleanValue' is deprecated: BooleanValue can never throw. Use Isolate version. [-Wdeprecated-declarations]
X(bool, Boolean)
^
../../nan/nan_converters_43_inl.h:37:15: note: expanded from macro 'X'
  return val->NAME ## Value(isolate->GetCurrentContext());                     \
              ^
<scratch space>:30:1: note: expanded from here
BooleanValue
^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2561:3: note: 'BooleanValue' has been explicitly marked deprecated here
  V8_DEPRECATED("BooleanValue can never throw. Use Isolate version.",
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:307:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/unix/pty.cc:20:
In file included from ../../nan/nan.h:223:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:356:37: error: too few arguments to function call, expected 2, have 1
  return v8::StringObject::New(value).As<v8::StringObject>();
         ~~~~~~~~~~~~~~~~~~~~~      ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:5380:3: note: 'New' declared here
  static Local<Value> New(Isolate* isolate, Local<String> value);
  ^
In file included from ../src/unix/pty.cc:20:
In file included from ../../nan/nan.h:223:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:356:58: error: expected '(' for function-style cast or type construction
  return v8::StringObject::New(value).As<v8::StringObject>();
                                         ~~~~~~~~~~~~~~~~^
../../nan/nan_implementation_12_inl.h:356:60: error: expected expression
  return v8::StringObject::New(value).As<v8::StringObject>();
                                                           ^
In file included from ../src/unix/pty.cc:20:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(persistent().IsNearDeath());
           ~~~~~~~~~~~~ ^
/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
In file included from ../src/unix/pty.cc:20:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:127:26: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(wrap->handle_.IsNearDeath());
           ~~~~~~~~~~~~~ ^
/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
../src/unix/pty.cc:154:39: error: no matching member function for call to 'ToString'
  v8::String::Utf8Value file(info[0]->ToString());
                             ~~~~~~~~~^~~~~~~~
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2528:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2544:35: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                    Local<String> ToString(Isolate* isolate) const);
                                  ^
../src/unix/pty.cc:165:69: error: no matching member function for call to 'ToString'
    v8::String::Utf8Value arg(argv_->Get(Nan::New<v8::Integer>(i))->ToString());
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2528:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2544:35: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                    Local<String> ToString(Isolate* isolate) const);
                                  ^
../src/unix/pty.cc:165:38: warning: 'Get' is deprecated: Use maybe version [-Wdeprecated-declarations]
    v8::String::Utf8Value arg(argv_->Get(Nan::New<v8::Integer>(i))->ToString());
                                     ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:3412:3: note: 'Get' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:322:29: note: expanded from macro 'V8_DEPRECATE_SOON'
  declarator __attribute__((deprecated(message)))
                            ^
../src/unix/pty.cc:176:69: error: no matching member function for call to 'ToString'
    v8::String::Utf8Value pair(env_->Get(Nan::New<v8::Integer>(i))->ToString());
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2528:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2544:35: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                    Local<String> ToString(Isolate* isolate) const);
                                  ^
../src/unix/pty.cc:176:38: warning: 'Get' is deprecated: Use maybe version [-Wdeprecated-declarations]
    v8::String::Utf8Value pair(env_->Get(Nan::New<v8::Integer>(i))->ToString());
                                     ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:3412:3: note: 'Get' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:322:29: note: expanded from macro 'V8_DEPRECATE_SOON'
  declarator __attribute__((deprecated(message)))
                            ^
../src/unix/pty.cc:181:39: error: no matching member function for call to 'ToString'
  v8::String::Utf8Value cwd_(info[3]->ToString());
                             ~~~~~~~~~^~~~~~~~
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2528:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2544:35: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                    Local<String> ToString(Isolate* isolate) const);
                                  ^
../src/unix/pty.cc:186:39: error: too few arguments to function call, single argument 'context' was not specified
  winp.ws_col = info[4]->IntegerValue();
                ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:187:39: error: too few arguments to function call, single argument 'context' was not specified
  winp.ws_row = info[5]->IntegerValue();
                ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:195:16: error: no matching member function for call to 'ToBoolean'
  if (info[8]->ToBoolean()->Value()) {
      ~~~~~~~~~^~~~~~~~~
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2524:63: note: candidate function not viable: requires single argument 'context', but no arguments were provided
                    V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
                                                              ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2540:18: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
  Local<Boolean> ToBoolean(Isolate* isolate) const;
                 ^
../src/unix/pty.cc:230:35: error: too few arguments to function call, single argument 'context' was not specified
  int uid = info[6]->IntegerValue();
            ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:231:35: error: too few arguments to function call, single argument 'context' was not specified
  int gid = info[7]->IntegerValue();
            ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:315:39: error: too few arguments to function call, single argument 'context' was not specified
  winp.ws_col = info[0]->IntegerValue();
                ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:316:39: error: too few arguments to function call, single argument 'context' was not specified
  winp.ws_row = info[1]->IntegerValue();
                ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:360:34: error: too few arguments to function call, single argument 'context' was not specified
  int fd = info[0]->IntegerValue();
           ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:363:39: error: too few arguments to function call, single argument 'context' was not specified
  winp.ws_col = info[1]->IntegerValue();
                ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/unix/pty.cc:364:39: error: too few arguments to function call, single argument 'context' was not specified
  winp.ws_row = info[2]->IntegerValue();
                ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/mogden/.node-gyp/12.0.0/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 warnings and 20 errors generated.
make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/mogden/n/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/mogden/n/bin/node" "/Users/mogden/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mogden/repos/github.com/machellerogden/node-pty-test/node_modules/node-pty
gyp ERR! node -v v12.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mogden/.npm/_logs/2019-04-24T02_29_19_741Z-debug.log
debt help wanted

Comentario más útil

Lo encontré, por extraño que parezca, era el PSIZE_T no inicializado en la misma función

Todos 13 comentarios

¿Parece que nan necesita actualizarse? Siéntase libre de hacer un PR para esto, probablemente no lo investigaré hasta que Electron llegue al nodo 12

@Tyriar El Electron 5 recién lanzado ya tiene el nodo 12 en él:
https://electronjs.org/blog/electron-5-0

@gpetrov sí, es probable que VS Code tarde un poco en reunir las compilaciones de exploración para la v5. Nuevamente, siéntase libre de investigar esto si lo necesita más rápido que nosotros.

gracias @Tyriar , veré qué puedo hacer. Estamos usando node-pty en NWJS y está mucho más lejos que Electron. Ya en Chrome 74 y Node 12.

También noté:

.. \ src \ win \ conpty.cc (249): error C2660: 'v8 :: Function :: Call': la función no toma 3 argumentos [xxx \ node_modules \ node-pty \ build \ conpty.vcxproj]

Gracias por tu gran trabajo por cierto, nos ayudó mucho conseguir un terminal completamente funcional en Windows.

Tengo que compilarlo en https://github.com/Eugeny/node-pty/commit/cb3b3f6a9fb2d94525181c796623181692682974 , pero hay un problema extraño que parece estar relacionado con llamar a exitCallback : todas las pruebas relacionadas fallan con Uncaught TypeError: number 0 is not a function y no hay seguimiento de pila.

Usar Nan::Callback lugar simplemente bloquea el proceso.

Luciendo genial @Tyriar pueda asesorar sobre las pruebas y el bloqueo; parece una pequeña cosa que arreglar, pero debe conocer el núcleo del error.

@Eugeny hmm, nada que se destaque como obviamente incorrecto en la diferencia, el error suena como exitCallback en el lado nativo se está asignando a 0 lugar de la devolución de llamada, ni siquiera cambiaste la línea que saca eso de info[4] aunque.

@Tyriar Verifiqué ->IsFunction() justo antes de la llamada y estaba bien: la ejecución incluso avanza más allá de la línea ->Call() , y el mensaje de error aparece más tarde, pero la devolución de llamada real nunca se ejecuta.

Intenté guardar el v8 :: Context con la devolución de llamada por si acaso, sin éxito

TBH Estoy perdido aquí @Tyriar : pasé algunas horas jugando con la devolución de llamada y todavía no obtuve nada. No estoy tan profundo en el desarrollo nativo de Node, por lo que debe haber algo obvio que me falta

Lo encontré, por extraño que parezca, era el PSIZE_T no inicializado en la misma función

Intenté instalar node-pty usando el nodo 12.3.1 y 12.0.0, ninguno funcionó, con el nodo 11.15.0 funciona ...

¿Debo reabrir este problema o presentar uno nuevo?

Tuve los mismos errores en mi consola, pero el código funciona bien después de que se realiza la instalación y estoy usando el nodo v10.13.0. Ejecuto este ejemplo muy bien:

var os = require ('os');
var pty = require ('node-pty');

var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
var ptyProcess = pty.spawn(shell, ['vue create app'], {
    name: 'vue',
    cwd: process.env.HOME,
    env: process.env
});
ptyProcess.write('keydown');
ptyProcess.on('data', function(data) {
    process.stdout.write(data.toString().trim());
});

La salida:
Vue CLI v3.11.0
┌───────────────────────────┐
│ Actualización disponible: 4.0.4 │
└───────────────────────────┘
? Elija un ajuste preestablecido: (Utilice las teclas de flecha)

predeterminado (babel, eslint)
¿Seleccionar funciones manualmente? Elija un ajuste preestablecido:
predeterminado (babel, eslint)

¿Fue útil esta página
0 / 5 - 0 calificaciones