首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wercker配置rails 5.1 + reactjs与webpacker

Wercker配置rails 5.1 + reactjs与webpacker
EN

Stack Overflow用户
提问于 2017-10-13 18:51:48
回答 1查看 217关注 0票数 0

我很难在rails / Webpacker项目上设置Wercker。

我首先必须添加步骤来安装节点,然后另一个步骤来预编译,然后再安装纱线。首先,它很好,但随后我将依赖项添加到项目中,并知道我被困在3个依赖项上,并使用相同的错误消息:

代码语言:javascript
复制
ERROR in ./app/javascript/app/index.js
Module not found: Error: Can't resolve 'redux-thunk' in '/pipeline/source/app/javascript/app'
 @ ./app/javascript/app/index.js 5:0-32
 @ ./app/javascript/packs/app.js

只有redux-thunkreact-redux-i18nreact-spinkit才会发生这种情况

我尝试添加一个步骤yarn install,它通过这个过程,但没有解决问题。

这是我的wercker.yml

代码语言:javascript
复制
# wercker.yml
box: ruby:2.4.1

services:
    - redis
    - postgres

build:
    steps:
        - louischavane/install-phantomjs@0.0.5
        - rails-database-yml
        - script:
            name: nokogiri tricks
            code: bundle config build.nokogiri --use-system-libraries
        - bundle-install
        - bigtruedata/install-node@2.1.1
        - akupila/yarn@0.2.0
        - script:
            name: yarn-install
            code: yarn install
        - script:
            name: pre-compile react packs
            code: NODE_ENV=test bundle exec rails webpacker:compile
        - script:
            name: run migration
            code: rake db:migrate RAILS_ENV=test
        - script:
            name: load fixture
            code: rake db:fixtures:load RAILS_ENV=test
        - script:
            name: run rubocop
            code: bundle exec rubocop
        - script:
            name: test
            code: bundle exec rake test RAILS_ENV=test
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-16 12:59:38

找到了一种在预编译之前添加删除节点模块的步骤:

代码语言:javascript
复制
- script:
  name: delete node modules
  code: rm -rf node_modules

更新

我现在有一个干净的Wercker设置处理测试,系统测试与铬无头,rubocop,eslint和手写笔。你可以在这里找到它:https://gist.github.com/adesurirey/7c013bfa1a9bed9d56ffea54db5d6288

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46736345

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档