open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.12k stars 590 forks source link

Error installing @open-wa library #1747

Closed phelipee15 closed 3 years ago

phelipee15 commented 3 years ago

Describe the bug I've always used the same code base for a few months and never had any problems, but when I upgraded from 3.11.5 to the latest 4.1.0, every time I put "npm i --save @open-wa/wa-automate @latest" gives an ESM-related error: [ESM URL SCHEME ERROR NOT SUPPORTED].

Steps to Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

create() code This is the code you use to create the client. e.g

create(options)
    .then((client) => start(client))
    .catch((err) => new Error(err))

Expected behavior My problem is when installing a library, and if I try to run the BOT, it says that the Module was not installed, because I can't install it.

DEBUG INFO This is the info printed to the console when you start your app. It should look like this

PS C:\Users\Usuário\Desktop\Bolt> node .
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '@open-wa/wa-automate'
Require stack:
- C:\Users\Usuário\Desktop\Bolt\index.js
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\Usuário\Desktop\Bolt\index.js:1:28)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\Usuário\\Desktop\\Bolt\\index.js' ]
}
PS C:\Users\Usuário\Desktop\Bolt> npm i --save @open-wa/wa-automate@latest

> puppeteer@9.1.1 install C:\Users\Usuário\Desktop\Bolt\node_modules\puppeteer
> node install.js

Downloading Chromium r869685 - 166.1 Mb [====================] 100% 0.0s
Chromium (869685) downloaded to C:\Users\Usuário\Desktop\Bolt\node_modules\puppeteer\.local-chromium\win64-869685

> @open-wa/wa-automate@4.1.0 install C:\Users\Usuário\Desktop\Bolt\node_modules\@open-wa\wa-automate
> cross-env npm_config_yes=true npx ignore-check@latest -p '**.data.json' -p '**.node-persist**' --comment 'managed by open-wa'

npx: instalou 63 em 31.672s
(node:9632) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/run_main.js:54
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:720:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:42:40)
    at link (internal/modules/esm/module_job.js:41:36) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
npm WARN notsup Unsupported engine for @open-wa/wa-automate@4.1.0: wanted: {"node":">=12.18.3","npm":">=7.9.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: @open-wa/wa-automate@4.1.0
npm WARN swagger-stats@0.99.1 requires a peer of prom-client@>= 10 <= 13 but none is installed. You must install peer dependencies yourself.
npm WARN bolt-bot@1.1.6 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @open-wa/wa-automate@4.1.0 install: `cross-env npm_config_yes=true npx ignore-check@latest -p '**.data.json' -p '**.node-persist**' --comment 'mant**' --comment 'managed by open-wa'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @open-wa/wa-automate@4.1.0 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!     C:\Users\Usuário\AppData\Roaming\npm-cache\_logs\2021-06-02T10_15_53_071Z-debug.log

Screenshots If applicable, add screenshots to help explain your problem. Use ```headless: false image image



**Host (please complete the following information):**
 - OS: Google Chrome (Mac OS)

**Additional context**
I don't know what to do, I just wanted to understand why this mistake happened to me out of nowhere.
smashah commented 3 years ago

@phelipee15 thanks for filling out the issue template

please update your node and npm version

image

smashah commented 3 years ago

looks like this is a duplicate of #1738

phelipee15 commented 3 years ago

image I don't know why, but it's like this.

image @smashah