Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in@babel/helper-compilation-targets/package.json

Recently, I got unexpected problem when deploying my Ruby on Rails app to Heroku:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in node_modules/@babel/helper-compilation-targets/package.json

To be honest, I do not have any idea because I did not touch any javascript code at all, does anyone encounter this error and resolved it?

Here is the full logs: https://gist.github.com/johnvmo/b3340f541cf32cb0c15ecbffc1aca6f9

I am very appreciated if someone can help.

like image 401
Chau Giang Avatar asked May 29 '20 08:05

Chau Giang


2 Answers

Ran into the same error and found this:

Solution

This is a regression in Node.js. If you hit this issue from search engines, please choose one of the following solutions

  1. update @babel deps to v7.8.7

  2. use Node < 13.9

  3. wait until nodejs/node#32107 is fixed! (Probably in the next Node.js patch release).

https://github.com/babel/babel/issues/11216

like image 164
DoubleMalt Avatar answered Oct 23 '22 05:10

DoubleMalt


I have simple solution just downgrade Nodejs version to v10 LTS or 11. For example in my Raisl app, my Dockerfile look like this:

FROM ruby:2.7.1

ARG DEBIAN_FRONTEND=noninteractive
ENV RAILS_ENV=production
ENV RAILS_SERVE_STATIC_FILES=true
ENV RAILS_LOG_TO_STDOUT=true
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
    apt-get update && \
    apt-get install -qq -y nodejs yarn vim
#RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends nodejs
COPY Gemfile* /usr/src/app/
WORKDIR /usr/src/app
RUN bundle config --global frozen 1
RUN bundle config set without 'development test'
RUN bundle install 
#RUN yarn install --prod
COPY . /usr/src/app/
# RUN bundle exec rake assets:precompile

CMD ["bin/rails", "s", "-b", "0.0.0.0"]
like image 1
Chau Giang Avatar answered Oct 23 '22 05:10

Chau Giang