compulim / web-speech-cognitive-services

Polyfill Web Speech API with Cognitive Services Bing Speech for both speech-to-text and text-to-speech service.
https://compulim.github.io/web-speech-cognitive-services
MIT License
61 stars 18 forks source link

Install failure at p-defer-es5@2.0.0 postinstall:commonjs script. #167

Open JamesBrill opened 2 years ago

JamesBrill commented 2 years ago

I'm unable to install the latest version of this polyfill (note that I have installed the Azure peer dependency). The failure comes from a post-install script in the latest major version of a dependency owned by the author of this polyfill: p-defer-es5. The issue seems related to a mismatch between CommonJS and ES6 modules:

> p-defer-es5@2.0.0 postinstall /home/consumer-package/node_modules/p-defer-es5
> npm run postinstall:commonjs && npm run postinstall:esm

> p-defer-es5@2.0.0 postinstall:commonjs /home/consumer-package/node_modules/p-defer-es5
> node ./scripts/esbuild.mjs p-defer ./src/index.js cjs ./lib/index.bundled.js && babel ./lib/index.bundled.js --config-file ./babel.config.commonjs.json --out-file ./lib/index.js

/home/consumer-package/node_modules/p-defer-es5/scripts/esbuild.mjs:1
import { createRequire } from 'module';
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

I am still able to install web-speech-cognitive-services 7.1.0, which appears to use the previous major version of p-defer-es5.

giulianf commented 2 years ago

Hi,

do you find a workaround to avoid this ? Can't resolve 'p-defer-es5' in '/Users/julienfumanti/Documents/bitbucket/lawfirm-front/node_modules/web-speech-cognitive-services/lib/SpeechServices/TextToSpeech'

Thx

JamesBrill commented 2 years ago

Hi @giulianf Not sure if we're having the same issue (you'll get that message when building your web app if that package wasn't installed successfully). I'm afraid the only clear workaround that worked for me was to fix the version of web-speech-cognitive-services at 7.1.0 and do another install.

giulianf commented 2 years ago

ok could be close I downgraded @7.1.0

marcbuils commented 1 year ago

I have the same issue with @7.1.3... (with yarn)