Webpack在本地编译,但不在Heroku上编译

时间:2017-03-29 16:18:32

标签: ruby-on-rails reactjs heroku webpack

我的Webpack正在我的开发环境中正确编译,但是一旦我部署到Heroku,我收到的错误是Chart.js不是模块 -

remote: -----> npm install --only=dev
remote: webpack-rails-example@0.0.1 /tmp/build_c869c8be2e135052ead9047bc4bb375a
remote: ├── babel@6.23.0
remote: ├─┬ babel-cli@6.24.0
remote: │ ├── babel-polyfill@6.23.0
remote: │ ├─┬ babel-register@6.24.0
remote: │ │ ├─┬ home-or-tmp@2.0.0
remote: │ │ │ ├── os-homedir@1.0.2
remote: │ │ │ └── os-tmpdir@1.0.2
remote: │ │ └── source-map-support@0.4.14
remote: │ ├─┬ chokidar@1.6.1
remote: │ │ ├─┬ anymatch@1.3.0
remote: │ │ │ └── arrify@1.0.1
remote: │ │ ├── async-each@1.0.1
remote: │ │ ├─┬ is-binary-path@1.0.1
remote: │ │ │ └── binary-extensions@1.8.0
remote: │ │ ├─┬ is-glob@2.0.1
remote: │ │ │ └── is-extglob@1.0.0
remote: │ │ └─┬ readdirp@2.1.0
remote: │ │   └── set-immediate-shim@1.0.1
remote: │ ├─┬ commander@2.9.0
remote: │ │ └── graceful-readlink@1.0.1
remote: │ ├── convert-source-map@1.5.0
remote: │ ├── fs-readdir-recursive@1.0.0
remote: │ ├─┬ glob@7.1.1
remote: │ │ ├── fs.realpath@1.0.0
remote: │ │ ├─┬ inflight@1.0.6
remote: │ │ │ └── wrappy@1.0.2
remote: │ │ └── once@1.4.0
remote: │ ├─┬ output-file-sync@1.1.2
remote: │ │ └── graceful-fs@4.1.11
remote: │ ├── slash@1.0.0
remote: │ ├── source-map@0.5.6
remote: │ └─┬ v8flags@2.0.11
remote: │   └── user-home@1.1.1
remote: ├─┬ babel-core@6.24.0
remote: │ ├─┬ babel-code-frame@6.22.0
remote: │ │ ├─┬ chalk@1.1.3
remote: │ │ │ ├── ansi-styles@2.2.1
remote: │ │ │ ├── escape-string-regexp@1.0.5
remote: │ │ │ ├── has-ansi@2.0.0
remote: │ │ │ └── supports-color@2.0.0
remote: │ │ └── esutils@2.0.2
remote: │ ├─┬ babel-generator@6.24.0
remote: │ │ ├─┬ detect-indent@4.0.0
remote: │ │ │ └─┬ repeating@2.0.1
remote: │ │ │   └─┬ is-finite@1.0.2
remote: │ │ │     └── number-is-nan@1.0.1
remote: │ │ ├── jsesc@1.3.0
remote: │ │ └── trim-right@1.0.1
remote: │ ├── babel-helpers@6.23.0
remote: │ ├── babel-messages@6.23.0
remote: │ ├── babel-template@6.23.0
remote: │ ├─┬ babel-traverse@6.23.1
remote: │ │ └── globals@9.17.0
remote: │ ├─┬ babel-types@6.23.0
remote: │ │ └── to-fast-properties@1.0.2
remote: │ ├── babylon@6.16.1
remote: │ ├── json5@0.5.1
remote: │ ├─┬ minimatch@3.0.3
remote: │ │ └─┬ brace-expansion@1.1.6
remote: │ │   ├── balanced-match@0.4.2
remote: │ │   └── concat-map@0.0.1
remote: │ └── private@0.1.7
remote: ├─┬ babel-loader@6.4.1
remote: │ ├─┬ find-cache-dir@0.1.1
remote: │ │ ├── commondir@1.0.1
remote: │ │ └─┬ pkg-dir@1.0.0
remote: │ │   └─┬ find-up@1.1.2
remote: │ │     ├── path-exists@2.1.0
remote: │ │     └─┬ pinkie-promise@2.0.1
remote: │ │       └── pinkie@2.0.4
remote: │ ├─┬ loader-utils@0.2.17
remote: │ │ ├── big.js@3.1.3
remote: │ │ └── emojis-list@2.1.0
remote: │ ├─┬ mkdirp@0.5.1
remote: │ │ └── minimist@0.0.8
remote: │ └── object-assign@4.1.1
remote: ├─┬ babel-preset-react@6.23.0
remote: │ ├── babel-plugin-syntax-jsx@6.18.0
remote: │ ├── babel-plugin-transform-react-display-name@6.23.0
remote: │ ├─┬ babel-plugin-transform-react-jsx@6.23.0
remote: │ │ └── babel-helper-builder-react-jsx@6.23.0
remote: │ ├── babel-plugin-transform-react-jsx-self@6.22.0
remote: │ ├── babel-plugin-transform-react-jsx-source@6.22.0
remote: │ └─┬ babel-preset-flow@6.23.0
remote: │   └─┬ babel-plugin-transform-flow-strip-types@6.22.0
remote: │     └── babel-plugin-syntax-flow@6.18.0
remote: ├─┬ chart.js@2.5.0
remote: │ ├─┬ chartjs-color@2.1.0
remote: │ │ ├─┬ chartjs-color-string@0.4.0
remote: │ │ │ └── color-name@1.1.2
remote: │ │ └── color-convert@0.5.3
remote: │ └── moment@2.18.1
remote: ├─┬ css-loader@0.26.4
remote: │ ├─┬ css-selector-tokenizer@0.7.0
remote: │ │ ├── cssesc@0.1.0
remote: │ │ ├── fastparse@1.1.1
remote: │ │ └─┬ regexpu-core@1.0.0
remote: │ │   ├── regenerate@1.3.2
remote: │ │   ├── regjsgen@0.2.0
remote: │ │   └─┬ regjsparser@0.1.5
remote: │ │     └── jsesc@0.5.0
remote: │ ├─┬ cssnano@3.10.0
remote: │ │ ├─┬ autoprefixer@6.7.7
remote: │ │ │ ├─┬ browserslist@1.7.7
remote: │ │ │ │ └── electron-to-chromium@1.3.2
remote: │ │ │ ├── caniuse-db@1.0.30000646
remote: │ │ │ ├── normalize-range@0.1.2
remote: │ │ │ └── num2fraction@1.2.2
remote: │ │ ├── decamelize@1.2.0
remote: │ │ ├── defined@1.0.0
remote: │ │ ├─┬ has@1.0.1
remote: │ │ │ └── function-bind@1.1.0
remote: │ │ ├─┬ postcss-calc@5.3.1
remote: │ │ │ ├── postcss-message-helpers@2.0.0
remote: │ │ │ └─┬ reduce-css-calc@1.3.0
remote: │ │ │   ├── math-expression-evaluator@1.2.16
remote: │ │ │   └── reduce-function-call@1.0.2
remote: │ │ ├─┬ postcss-colormin@2.2.2
remote: │ │ │ └─┬ colormin@1.1.2
remote: │ │ │   ├─┬ color@0.11.4
remote: │ │ │   │ ├── color-convert@1.9.0
remote: │ │ │   │ └── color-string@0.3.0
remote: │ │ │   └── css-color-names@0.0.4
remote: │ │ ├── postcss-convert-values@2.6.1
remote: │ │ ├── postcss-discard-comments@2.0.4
remote: │ │ ├── postcss-discard-duplicates@2.1.0
remote: │ │ ├── postcss-discard-empty@2.1.0
remote: │ │ ├── postcss-discard-overridden@0.1.1
remote: │ │ ├─┬ postcss-discard-unused@2.2.3
remote: │ │ │ └── uniqs@2.0.0
remote: │ │ ├─┬ postcss-filter-plugins@2.0.2
remote: │ │ │ └─┬ uniqid@4.1.1
remote: │ │ │   └── macaddress@0.2.8
remote: │ │ ├── postcss-merge-idents@2.1.7
remote: │ │ ├── postcss-merge-longhand@2.0.2
remote: │ │ ├─┬ postcss-merge-rules@2.1.2
remote: │ │ │ ├─┬ caniuse-api@1.5.3
remote: │ │ │ │ ├── lodash.memoize@4.1.2
remote: │ │ │ │ └── lodash.uniq@4.5.0
remote: │ │ │ ├─┬ postcss-selector-parser@2.2.3
remote: │ │ │ │ ├── flatten@1.0.2
remote: │ │ │ │ ├── indexes-of@1.0.1
remote: │ │ │ │ └── uniq@1.0.1
remote: │ │ │ └── vendors@1.0.1
remote: │ │ ├── postcss-minify-font-values@1.0.5
remote: │ │ ├── postcss-minify-gradients@1.0.5
remote: │ │ ├─┬ postcss-minify-params@1.2.2
remote: │ │ │ └── alphanum-sort@1.0.2
remote: │ │ ├── postcss-minify-selectors@2.1.1
remote: │ │ ├── postcss-normalize-charset@1.1.1
remote: │ │ ├─┬ postcss-normalize-url@3.0.8
remote: │ │ │ ├── is-absolute-url@2.1.0
remote: │ │ │ └─┬ normalize-url@1.9.1
remote: │ │ │   ├── prepend-http@1.0.4
remote: │ │ │   ├── query-string@4.3.2
remote: │ │ │   └─┬ sort-keys@1.1.2
remote: │ │ │     └── is-plain-obj@1.1.0
remote: │ │ ├── postcss-ordered-values@2.2.3
remote: │ │ ├── postcss-reduce-idents@2.4.0
remote: │ │ ├── postcss-reduce-initial@1.0.1
remote: │ │ ├── postcss-reduce-transforms@1.0.4
remote: │ │ ├─┬ postcss-svgo@2.1.6
remote: │ │ │ ├─┬ is-svg@2.1.0
remote: │ │ │ │ └── html-comment-regex@1.1.1
remote: │ │ │ └─┬ svgo@0.7.2
remote: │ │ │   ├─┬ coa@1.0.1
remote: │ │ │   │ └── q@1.5.0
remote: │ │ │   ├── colors@1.1.2
remote: │ │ │   ├─┬ csso@2.3.2
remote: │ │ │   │ └── clap@1.1.3
remote: │ │ │   ├─┬ js-yaml@3.7.0
remote: │ │ │   │ ├─┬ argparse@1.0.9
remote: │ │ │   │ │ └── sprintf-js@1.0.3
remote: │ │ │   │ └── esprima@2.7.3
remote: │ │ │   ├── sax@1.2.2
remote: │ │ │   └── whet.extend@0.9.9
remote: │ │ ├── postcss-unique-selectors@2.0.2
remote: │ │ ├── postcss-value-parser@3.3.0
remote: │ │ └── postcss-zindex@2.2.0
remote: │ ├── loader-utils@1.1.0
remote: │ ├── lodash.camelcase@4.3.0
remote: │ ├─┬ postcss@5.2.16
remote: │ │ └── js-base64@2.1.9
remote: │ ├── postcss-modules-extract-imports@1.0.1
remote: │ ├─┬ postcss-modules-local-by-default@1.1.1
remote: │ │ └── css-selector-tokenizer@0.6.0
remote: │ ├─┬ postcss-modules-scope@1.0.2
remote: │ │ └── css-selector-tokenizer@0.6.0
remote: │ ├─┬ postcss-modules-values@1.2.2
remote: │ │ └── icss-replace-symbols@1.0.2
remote: │ └── source-list-map@0.1.8
remote: ├─┬ extract-text-webpack-plugin@1.0.1
remote: │ ├── async@1.5.2
remote: │ └── webpack-sources@0.1.5
remote: ├── jquery@3.2.1
remote: ├─┬ react@15.4.2
remote: │ └─┬ fbjs@0.8.11
remote: │   ├── core-js@1.2.7
remote: │   ├─┬ isomorphic-fetch@2.2.1
remote: │   │ ├─┬ node-fetch@1.6.3
remote: │   │ │ ├─┬ encoding@0.1.12
remote: │   │ │ │ └── iconv-lite@0.4.15
remote: │   │ │ └── is-stream@1.1.0
remote: │   │ └── whatwg-fetch@2.0.3
remote: │   ├─┬ promise@7.1.1
remote: │   │ └── asap@2.0.5
remote: │   ├── setimmediate@1.0.5
remote: │   └── ua-parser-js@0.7.12
remote: ├── react-dom@15.4.2
remote: ├─┬ react-search-input@0.10.4
remote: │ └── fuse.js@2.6.2
remote: ├─┬ style-loader@0.13.2
remote: │ └── loader-utils@1.1.0
remote: ├─┬ webpack@1.14.0
remote: │ ├── acorn@3.3.0
remote: │ ├── clone@1.0.2
remote: │ ├─┬ enhanced-resolve@0.9.1
remote: │ │ └── memory-fs@0.2.0
remote: │ ├── interpret@0.6.6
remote: │ ├── memory-fs@0.3.0
remote: │ ├─┬ node-libs-browser@0.7.0
remote: │ │ ├── assert@1.4.1
remote: │ │ ├─┬ browserify-zlib@0.1.4
remote: │ │ │ └── pako@0.2.9
remote: │ │ ├─┬ buffer@4.9.1
remote: │ │ │ ├── base64-js@1.2.0
remote: │ │ │ └── ieee754@1.1.8
remote: │ │ ├─┬ console-browserify@1.1.0
remote: │ │ │ └── date-now@0.1.4
remote: │ │ ├── constants-browserify@1.0.0
remote: │ │ ├─┬ crypto-browserify@3.3.0
remote: │ │ │ ├── browserify-aes@0.4.0
remote: │ │ │ ├── pbkdf2-compat@2.0.1
remote: │ │ │ ├── ripemd160@0.2.0
remote: │ │ │ └── sha.js@2.2.6
remote: │ │ ├── domain-browser@1.1.7
remote: │ │ ├── events@1.1.1
remote: │ │ ├── https-browserify@0.0.1
remote: │ │ ├── os-browserify@0.2.1
remote: │ │ ├── path-browserify@0.0.0
remote: │ │ ├── process@0.11.9
remote: │ │ ├── punycode@1.4.1
remote: │ │ ├── querystring-es3@0.2.1
remote: │ │ ├── stream-browserify@2.0.1
remote: │ │ ├─┬ stream-http@2.6.3
remote: │ │ │ ├── builtin-status-codes@3.0.0
remote: │ │ │ ├── to-arraybuffer@1.0.1
remote: │ │ │ └── xtend@4.0.1
remote: │ │ ├── timers-browserify@2.0.2
remote: │ │ ├── tty-browserify@0.0.0
remote: │ │ ├─┬ url@0.11.0
remote: │ │ │ ├── punycode@1.3.2
remote: │ │ │ └── querystring@0.2.0
remote: │ │ ├─┬ util@0.10.3
remote: │ │ │ └── inherits@2.0.1
remote: │ │ └─┬ vm-browserify@0.0.4
remote: │ │   └── indexof@0.0.1
remote: │ ├── tapable@0.1.10
remote: │ ├─┬ uglify-js@2.7.5
remote: │ │ ├── async@0.2.10
remote: │ │ ├── uglify-to-browserify@1.0.2
remote: │ │ └─┬ yargs@3.10.0
remote: │ │   ├── camelcase@1.2.1
remote: │ │   ├─┬ cliui@2.1.0
remote: │ │   │ ├─┬ center-align@0.1.3
remote: │ │   │ │ ├─┬ align-text@0.1.4
remote: │ │   │ │ │ └── longest@1.0.1
remote: │ │   │ │ └── lazy-cache@1.0.4
remote: │ │   │ ├── right-align@0.1.3
remote: │ │   │ └── wordwrap@0.0.2
remote: │ │   └── window-size@0.1.0
remote: │ ├─┬ watchpack@0.2.9
remote: │ │ └── async@0.9.2
remote: │ └─┬ webpack-core@0.6.9
remote: │   └─┬ source-map@0.4.4
remote: │     └── amdefine@1.0.1
remote: └─┬ webpack-bundle-tracker@0.1.0
remote:   └─┬ strip-ansi@2.0.1
remote:     └── ansi-regex@1.1.1
remote:
remote: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
remote: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
remote: npm WARN webpack-rails-example@0.0.1 No repository field.
remote: -----> bundle exec rake webpack:compile
remote: ** Invoke webpack:compile (first_time)
remote: ** Invoke environment (first_time)
remote: ** Execute environment
remote: ** Execute webpack:compile
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/.bin/webpack --config /tmp/build_c869c8be2e135052ead9047bc4bb375a/config/webpack.config.js --bail
remote: Error
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/webpack/lib/Compilation.js:229:38
remote:     at onDoneResolving (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/webpack/lib/NormalModuleFactory.js:29:20)
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/webpack/lib/NormalModuleFactory.js:85:20
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/async/lib/async.js:726:13
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/async/lib/async.js:52:16
remote:     at done (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/async/lib/async.js:241:17)
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/async/lib/async.js:44:16
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/async/lib/async.js:723:17
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/async/lib/async.js:167:37
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:24:19
remote:     at onResolved (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/Resolver.js:38:18)
remote:     at innerCallback (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/Resolver.js:94:11)
remote:     at loggingCallbackWrapper (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/createInnerCallback.js:21:19)
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/tapable/lib/Tapable.js:134:6
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/ModulesInDirectoriesPlugin.js:54:23
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/Resolver.js:191:15
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/ModulesInDirectoriesPlugin.js:45:26
remote:     at loggingCallbackWrapper (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/createInnerCallback.js:21:19)
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/tapable/lib/Tapable.js:134:6
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/Resolver.js:122:33
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/Resolver.js:191:15
remote:     at applyPluginsParallelBailResult.createInnerCallback.log (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/Resolver.js:110:4)
remote:     at loggingCallbackWrapper (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/createInnerCallback.js:21:19)
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/tapable/lib/Tapable.js:134:6
remote:     at Resolver.<anonymous> (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/FileAppendPlugin.js:31:26)
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/Resolver.js:191:15
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/FileAppendPlugin.js:28:12
remote:     at Storage.finished (/tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
remote:     at /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/graceful-fs/polyfills.js:284:29
remote:     at FSReqWrap.oncomplete (fs.js:114:15)
remote: resolve module Chart.js in /tmp/build_c869c8be2e135052ead9047bc4bb375a/webpack/js/ui_components/datavisuals
remote:   looking for modules in /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules
remote:     /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/Chart.js doesn't exist (module as directory)
remote:     resolve 'file' Chart.js in /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules
remote:       resolve file
remote:         /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/Chart.js doesn't exist
remote:         /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/Chart.js.js doesn't exist
remote:         /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/Chart.js.jsx doesn't exist
remote:         /tmp/build_c869c8be2e135052ead9047bc4bb375a/node_modules/Chart.js.css doesn't exist
remote: rake aborted!
remote: Command failed with status (1): [/tmp/build_c869c8be2e135052ead9047bc4bb375...]
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/file_utils.rb:66:in `block in create_shell_runner'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/file_utils.rb:56:in `call'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/file_utils.rb:56:in `sh'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/webpack-rails-0.9.9/lib/tasks/webpack.rake:17:in `block (2 levels) in <top (required)>'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `call'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/bin/rake:23:in `load'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/bin/rake:23:in `<top (required)>'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/bin/bundle:22:in `load'
remote: /tmp/build_c869c8be2e135052ead9047bc4bb375a/vendor/bundle/ruby/2.2.0/bin/bundle:22:in `<main>'
remote: Tasks: TOP => webpack:compile
remote:  !     Push rejected, failed to compile webpack-rails app.
remote:
remote:  !     Push failed

我的webpack配置文件如下所示:         //     &#39;使用严格的&#39;;

var path = require('path');
var webpack = require('webpack');
var StatsPlugin = require('stats-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

// must match config.webpack.dev_server.port
var devServerPort = 3808;

// set NODE_ENV=production on the environment to add asset fingerprints
var production = process.env.NODE_ENV === 'production';

var config = {
  entry: {
    // Sources are expected to live in $app_root/webpack
    application: [
      './webpack/js/application.js',
      './webpack/stylesheets/application.scss'
    ],
    //'instcolors': './webpack/InstColors'
    /*
    dashboard: [
      './webpack/js/index', // entry point of our app. assets/js/index.js should require other js modules and dependencies it needs
      './webpack/stylesheets/main.css'
    ],
    ic_contact: './webpack/js/ic_contact', // entry point of our app. assets/js/index.js should require other js modules and dependencies it needs
    projects: [
      './webpack/js/ProjectList', // entry point of our app. assets/js/index.js should require other js modules and dependencies it needs
      './webpack/stylesheets/main.css'
    ]
    */
  },

  output: {
    // Build assets directly in to public/webpack/, let webpack know
    // that all webpacked assets start with webpack/

    // must match config.webpack.output_dir
    path: path.join(__dirname, '..', 'public', 'webpack'),
    publicPath: '/webpack/',

    filename: production ? '[name]-[chunkhash].js' : '[name].js'
  },

  resolve: {
    root: path.join(__dirname, '..', 'webpack')
  },

  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        // This has effect on the react lib size
        'NODE_ENV': JSON.stringify('development'),
      }
    }),
    // must match config.webpack.manifest_filename
    new StatsPlugin('manifest.json', {
      // We only need assetsByChunkName
      chunkModules: false,
      source: false,
      chunks: false,
      modules: false,
      assets: true
    }),
    new ExtractTextPlugin('./webpack/stylesheets/[name].css'),
    new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"vendor", /* filename= */"vendor.bundle.js")
  ],
  module: {
    loaders: [
      // to transform JSX into JS
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: {
          presets: ['react']
        }
      },
      // Extract css files
      {
          test: /\.css$/,
          loader: ExtractTextPlugin.extract("style-loader", "css-loader")
      },

    ],
  },

  resolve: {
    modulesDirectories: ['node_modules', 'bower_components'],
    extensions: ['', '.js', '.jsx', '.css', '.scss']
  },

};

if (production) {
  config.plugins.push(
    new webpack.NoErrorsPlugin(),
    new webpack.optimize.UglifyJsPlugin({
      minimize: false,
      compressor: { warnings: false },
      sourceMap: false
    }),
    new webpack.DefinePlugin({
      'process.env': { NODE_ENV: JSON.stringify('production') }
    }),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.OccurenceOrderPlugin()
  );
} else {
  config.devServer = {
    port: devServerPort,
    headers: { 'Access-Control-Allow-Origin': '*' }
  };
  config.output.publicPath = '//localhost:' + devServerPort + '/webpack/';
  // Source maps
  config.devtool = 'cheap-module-eval-source-map';
}

module.exports = config;

和我的package.json -

{
  "name": "webpack-rails-example",
  "version": "0.0.1",
  "license": "MIT",
  "devDependencies": {
    "babel": "^6.5.2",
    "babel-cli": "^6.18.0",
    "babel-core": "^6.18.2",
    "babel-loader": "^6.2.9",
    "babel-preset-react": "^6.16.0"
  },
  "dependencies": {
    "react-bootstrap": "^0.30.7",
    "stats-webpack-plugin": "^0.2.1",
    "react-router": "^2.0.0",
    "webpack-dev-server": "^1.9.0",
    "chart.js": "^2.4.0",
    "css-loader": "^0.26.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "jquery": "*",
    "react": "^15.4.1",
    "react-dom": "^15.4.1",
    "react-router": "^2.0.0",
    "react-search-input": "^0.10.3",
    "style-loader": "^0.13.1",
    "webpack": "^1.14.0",
    "webpack-bundle-tracker": "^0.1.0"
  },
  "scripts": {
    "start": "webpack-dev-server --config config/webpack.config.js"
  }
}

据我所知,似乎NPM软件包正在安装,那么为什么找不到这个模块呢?我对React很新(我是这个项目的后端开发人员),感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

从日志的第一行开始:npm install --only=dev看起来您devDependencieschart.js已在dependencies中注册,因此使用--only=dev将无法下载chart.js

要了解--only切换,here is the documentation

如果可能,我建议您从--only删除npm install标记。