Arrancándolo desde mi Linux server tengo un error
Al arrancar el bot con todas las dependencias instaladas me surge el siguiente error:
root@popisvending:~/PVWBOT# npm start
> [email protected] start /root/PVWBOT
> node ./app.js
internal/modules/cjs/loader.js:1102
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /root/PVWBOT/node_modules/nanoid/index.js
require() of ES modules is not supported.
require() of /root/PVWBOT/node_modules/nanoid/index.js from /root/PVWBOT/adapter/diaglogflow.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /root/PVWBOT/node_modules/nanoid/package.json.
at new NodeError (internal/errors.js:322:7)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (/root/PVWBOT/adapter/diaglogflow.js:3:20)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32) {
code: 'ERR_REQUIRE_ESM'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start 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! /root/.npm/_logs/2022-09-07T07_44_56_436Z-debug.log
No se qué hacer...
Gracias.
Me da el mismo error en windows, tiene que ver algun cambio en la libreria de nanoid. Lo que yo hice fue desactivar todos los import con dialogflow, que en mi caso no lo estoy utilizanodo.
Me da el mismo error en windows, tiene que ver algun cambio en la libreria de nanoid. Lo que yo hice fue desactivar todos los import con dialogflow, que en mi caso no lo estoy utilizanodo.
¿Cómo quito exactamente los inputs de DialogFlow? Yo creo que tampoco utilizo dicha función.
Gracias.
En adapter->index.js ahi quitas el import de dialogflow. Y claramente vas a tener q quitar todo el codigo q este usando ese import :)
En adapter->index.js ahi quitas el import de dialogflow. Y claramente vas a tener q quitar todo el codigo q este usando ese import :)
Genial Stevealv121, lo hice y parece que arranca hasta bastante más lejos... ahora tengo un error que parece más simple...
/root/PVWBOT/node_modules/puppeteer/.local-chromium/linux-982053/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory```
Vale, fui al Troubleshooting de GitHub de Puppeter y he encontrado el error... instalé librerías pero me sigue dando error... te informo en un rato
npm uninstall nanoid npm install nanoid@^3.0.0
Ahora me da este error...
[0919/152027.608233:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/root/PVWBOT/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
at Interface.<anonymous> (/root/PVWBOT/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68)
at Interface.emit (events.js:412:35)
at Interface.close (readline.js:530:8)
at Socket.onend (readline.js:254:10)
at Socket.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1333:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3302) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3302) [DEP0018] 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.```
Que impotencia... me funcionaba bien hace unos meses y ahora lo he vuelto a instalar y no soy capaz de arrancarlo...
Ahora me da este error...
[0919/152027.608233:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md at onClose (/root/PVWBOT/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20) at Interface.<anonymous> (/root/PVWBOT/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68) at Interface.emit (events.js:412:35) at Interface.close (readline.js:530:8) at Socket.onend (readline.js:254:10) at Socket.emit (events.js:412:35) at endReadableNT (internal/streams/readable.js:1333:12) at processTicksAndRejections (internal/process/task_queues.js:82:21) (Use `node --trace-warnings ...` to show where the warning was created) (node:3302) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:3302) [DEP0018] 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.``` Que impotencia... me funcionaba bien hace unos meses y ahora lo he vuelto a instalar y no soy capaz de arrancarlo...
Lo que puedo aportar para con ese error, es que, a mi me dio cuando estaba trabajando como root, lo que hice fue crear un usuario sudo y trabajar dentro de ~/home/"usuario"/bot/ siempre como el usuario sudo y nunca realice nada como root.
Ve el video si ya no lo hiciste
Ahora me da este error...
[0919/152027.608233:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md at onClose (/root/PVWBOT/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20) at Interface.<anonymous> (/root/PVWBOT/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68) at Interface.emit (events.js:412:35) at Interface.close (readline.js:530:8) at Socket.onend (readline.js:254:10) at Socket.emit (events.js:412:35) at endReadableNT (internal/streams/readable.js:1333:12) at processTicksAndRejections (internal/process/task_queues.js:82:21) (Use `node --trace-warnings ...` to show where the warning was created) (node:3302) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:3302) [DEP0018] 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.``` Que impotencia... me funcionaba bien hace unos meses y ahora lo he vuelto a instalar y no soy capaz de arrancarlo...Lo que puedo aportar para con ese error, es que, a mi me dio cuando estaba trabajando como root, lo que hice fue crear un usuario sudo y trabajar dentro de ~/home/"usuario"/bot/ siempre como el usuario sudo y nunca realice nada como root.
Ve el video si ya no lo hiciste
Voy a probarlo. He formateado el servidor VPS y creado un nuevo user, voy a dar todos los pasos...
Vale, lo tengo. Me seguía dando error... y finalmente lo he solucionado con este post de Stackoverflow
Gracias a todos.
Stale issue message
@Imereth perfecto gracias por compartir la solución cerraré el issue