2015-08-08 16 views
6

Während der Bereitstellung auf Heroku, habe ich "Error: Kann Modul nicht finden" -Fehler.Heroku + browserify-rails: Fehler: Kann Modul nicht finden

// package.json

{ 
    "name": "AppName", 
    "version": "1.0.0", 
    "description": "== README", 
    "main": "index.js", 
    "scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1" 
    }, 
    "repository": { 
    "type": "git", 
    "url": "somerepo.git" 
    }, 
    "author": "", 
    "license": "ISC", 
    "dependencies": { 
    "browserify": "^11.0.1", 
    "browserify-incremental": "^3.0.1", 
    "object-assign": "^3.0.0", 
    "react": "^0.13.3", 
    "react-image-gallery": "^0.4.1", 
    "reactify": "^1.1.1", 
    "superagent": "^1.3.0" 
    }, 
    "devDependencies": { 
    "es6-promise": "^2.3.0" 
    } 
} 

Dies ist das Protokoll, wenn ich "git push Heroku Master" laufen

remote: -----> Build succeeded! 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  └── [email protected] 

Danach habe ich diesen Fehler bekam.

remote: -----> Preparing app for Rails asset pipeline 
remote:  Running: rake assets:precompile 
remote:  AssetSync: using /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/config/initializers/asset_sync.rb 
remote:  [DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead 
remote:  I, [2015-08-08T08:09:07.998223 #595] INFO -- : Writing /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/public/assets/app.js-a57be479852c067f49ad0f930156917fbc753d782ac615de774d5f037964dcfe.jsx 
remote:  Browserify: /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/.bin/browserify -t reactify --extension=".js.jsx, .react.jsx, .jsx" -r react --list -o "/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/tmp/cache/browserify-rails/output20150808-595-41bgqb" - 
remote:  rake aborted! 
remote:  BrowserifyRails::BrowserifyError: Error while running `/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/.bin/browserify -t reactify --extension=".js.jsx, .react.jsx, .jsx" -r react --list -o "/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/tmp/cache/browserify-rails/ output20150808-595-41bgqb" -`: 
remote:  events.js:85 
remote:  throw er; // Unhandled 'error' event 
remote:  ^
remote:  Error: Cannot find module 'react-image-gallery' from '/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/app/assets/javascripts/components' 
remote:  at /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/browserify/node_modules/resolve/lib/async.js:46:17 
remote:  at process (/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/browserify/node_modules/resolve/lib/async.js:173:43) 
remote:  at ondir (/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/browserify/node_modules/resolve/lib/async.js:188:17) 
remote:  at load (/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/browserify/node_modules/resolve/lib/async.js:69:43) 
remote:  at onex (/tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/browserify/node_modules/resolve/lib/async.js:92:31) 
remote:  at /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/node_modules/browserify/node_modules/resolve/lib/async.js:22:47 
remote:  at FSReqWrap.oncomplete (fs.js:95:15) 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/browserify-rails-1.2.0/lib/browserify-rails/browserify_processor.rb:177:in `run_browserify' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/browserify-rails-1.2.0/lib/browserify-rails/browserify_processor.rb:113:in `dependencies' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/browserify-rails-1.2.0/lib/browserify-rails/browserify_processor.rb:90:in `commonjs_module?' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/browserify-rails-1.2.0/lib/browserify-rails/browserify_processor.rb:70:in `should_browserify?' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/browserify-rails-1.2.0/lib/browserify-rails/browserify_processor.rb:23:in `evaluate' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/legacy_tilt_processor.rb:25:in `call' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:75:in `call_processor' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `reverse_each' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `call_processors' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:86:in `load_asset_by_uri' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:45:in `block in load' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:155:in `fetch_asset_from_dependency_cache' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:38:in `load' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:20:in `block in initialize' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:47:in `yield' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:47:in `load' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/bundle.rb:23:in `block in call' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/utils.rb:183:in `dfs' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/bundle.rb:24:in `call' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:75:in `call_processor' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `reverse_each' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `call_processors' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:86:in `load_asset_by_uri' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:45:in `block in load' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:155:in `fetch_asset_from_dependency_cache' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:38:in `load' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:20:in `block in initialize' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:47:in `yield' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:47:in `load' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/base.rb:63:in `find_asset' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/base.rb:70:in `find_all_linked_assets' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/manifest.rb:138:in `block in find' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/path_utils.rb:223:in `block in stat_tree' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/path_utils.rb:207:in `block in stat_directory' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/path_utils.rb:204:in `each' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/path_utils.rb:204:in `stat_directory' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/path_utils.rb:222:in `stat_tree' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/legacy.rb:105:in `each' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/legacy.rb:105:in `block in logical_paths' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/legacy.rb:104:in `each' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/legacy.rb:104:in `logical_paths' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/manifest.rb:136:in `find' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/sprockets/manifest.rb:162:in `compile' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-3.2.0/lib/rake/sprocketstask.rb:147:in `with_logger' 
remote:  /tmp/build_65611fbfcf2cb3d9c9e2addc22015359/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define' 
remote:  Tasks: TOP => assets:precompile 
remote:  (See full trace by running task with --trace) 
remote: ! 
remote: !  Precompiling assets failed. 
remote: ! 
remote: 
remote: !  Push rejected, failed to compile Ruby app 

// app/assets/Javascripts/components/ImageSlider.js.jsx

var React = require('react'); 
var ImageGallery = require('react-image-gallery'); 
var request = require('superagent'); 

var ImageSlider = React.createClass({ 

    getInitialState: function() { 
    return { 
     tourImages: [] 
    } 
    }, 

    componentDidMount: function() { 
    var currentPath = window.location.pathname; 
    console.log(currentPath); 
    var tempArray = currentPath.split('/'); 
    var tourId = parseInt(tempArray[tempArray.length-1]); 
    this._fetchImages(tourId); 
    }, 

    _fetchImages: function(tourId) { 
    var _this = this; 
    request 
     .get('some_end_point/' + tourId + '/fetch_images') 
     .end(function(err, res) { 
     if (res.ok) { 
      _this.setState({ 
      tourImages: res.body.tourImages 
      }) 
      console.log(_this.state.tourImages); 
     } 
     }) 
    }, 

    render: function() { 
    var tourImages = this.state.tourImages; 
    var tourImageList = []; 
    for (var i = 0; i <= tourImages.length - 1; i++) { 
     tourImageList.push({original: tourImages[i].tour_photo.large.url, thumbnail: tourImages[i].tour_photo.small.url}) 
    } 
    var options = { 
     items: tourImageList 
    }; 
    return (
     <ImageGallery {...options} /> 
    ); 
    } 
}); 

module.exports = ImageSlider 

Aus dem Protokoll, kann ich die Linie unten ein Problem herauszufinden hat.

var ImageGallery = require('react-image-gallery'); 

Aber ich weiß nicht, warum es einen Fehler verursacht. Haben Sie eine Idee, wie Sie dieses Problem lösen können?

+0

hast du jemals herausgefunden? – stellard

+0

Ich konnte das Problem nicht lösen, also stelle ich schließlich nach AWS bereit. Ich musste "npm install --save react-image-gallery" nach "npm install" machen, und ich kann es nicht auf Heroku machen. –

+0

Ich habe ähnliches Problem. Ich bin nur ein bisschen gestorben ... :( – blushrt

Antwort

0

Ich habe einen ähnlichen Fehler beim Versuch, eine npm run compile mit Browserify auszuführen und zu reagieren.

Es war nicht in der Lage, meine Reaktion Edelstein selbst nach einer npm install zu erkennen.

Was ich tat, war:

rm -rf node_modules #to clean out stale node modules, and then 
npm update 
Verwandte Themen