semantic-release / travis-deploy-once

🚫Test multiple node versions on Travis. Deploy once. If all of them pass.
MIT License
33 stars 7 forks source link

Error: Cannot find module '@babel/preset-env' #98

Closed sudo-suhas closed 5 years ago

sudo-suhas commented 5 years ago

I am facing an error while trying to use travis-deploy-once in travis after installing it globally:

$ yarn global add travis-deploy-once
yarn global v1.3.2
(node:5065) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "travis-deploy-once@5.0.8" with binaries:
      - travis-deploy-once
Done in 3.86s.
after_success.2
0.36s$ travis-deploy-once "yarn global add semantic-release@12 && semantic-release"
/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/files/plugins.js:152
    throw e;
    ^
Error: Cannot find module '@babel/preset-env' from '/home/travis/build/sudo-suhas/elastic-builder'
    at Function.module.exports [as sync] (/home/travis/.config/yarn/global/node_modules/resolve/lib/sync.js:43:15)
    at resolveStandardizedName (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
    at resolvePreset (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/files/plugins.js:58:10)
    at loadPreset (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/files/plugins.js:77:20)
    at createDescriptor (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at items.map (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPresetDescriptors (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
    at passPerPreset (/home/travis/.config/yarn/global/node_modules/@babel/core/lib/config/config-descriptors.js:58:96)

I was able to reproduce this error locally as well. Rolling back to v5.0.4 fixed the issue.

See https://travis-ci.org/sudo-suhas/elastic-builder/jobs/433911736#L2059

pvdlg commented 5 years ago

It seems babel tries to load its plugin from the current working directory (/home/travis/build/sudo-suhas/elastic-builder) instead of from where it's installed. Looks like a bug. See https://github.com/babel/babel/issues/8777.

sudo-suhas commented 5 years ago

Thanks for digging into it. I'll subscribe to the issue in babel.

semantic-release-bot commented 5 years ago

:tada: This issue has been resolved in version 5.0.9 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

pvdlg commented 5 years ago

@sudo-suhas can you confirm it works with 5.0.9?

sudo-suhas commented 5 years ago

Yes, it is fixed now. Thanks!