错误[ERR_PACKAGE_PATH_NOT_EXPORTED]。没有 "出口 "主要解决[email protected]

问题描述 投票:4回答:1

最近,我在将Ruby on Rails应用部署到Heroku时,遇到了意外的问题。

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

说实话,我也不知道,因为我根本没有碰过任何javascript代码,有人遇到这个错误并解决了吗?

下面是完整的日志。https:/gist.github.comjohnvmob3340f541cf32cb0c15ecbffc1aca6f9。

如果有人能帮助我,我将非常感激。

javascript heroku babel
1个回答
1
投票

遇到同样的错误,发现了这个。

解决方法

这是Node.js的一个回归。如果你从搜索引擎中发现了这个问题,请选择以下的解决方案之一。

  1. 更新 @babel deps 到 v7.8.7。

  2. 使用 Node < 13.9

  3. 等到nodejsnode#32107被修复! (可能在下一个Node.js补丁版本中)。

https:/github.combabelbabelissues11216


0
投票

我有一个简单的解决方案,只要将Nodejs版本降级到v10 LTS或11即可。例如在我的Raisl应用中,我的Docker文件是这样的。

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"]
© www.soinside.com 2019 - 2024. All rights reserved.