Webpacker:ReferenceError:环境未定义

时间:2019-10-28 16:30:11

标签: webpacker ruby-on-rails-6 webpack-cli

在未指定环境的情况下尝试启动Rails Web服务器之后,Webpacker编译失败并显示以下错误:

[Webpacker] Compiling...
[Webpacker] Compilation failed:
/home/rails6/node_modules/webpack-cli/bin/cli.js:93
                                throw err;
                                ^

ReferenceError: environment is not defined
    at Object.<anonymous> (/home/rails6/config/webpack/environment.js:5:1)
    at Module._compile (/home/rails6/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
    at Module.load (internal/modules/cjs/loader.js:822:32)
    at Function.Module._load (internal/modules/cjs/loader.js:730:14)
    at Module.require (internal/modules/cjs/loader.js:864:19)
    at require (/home/rails6/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/rails6/config/webpack/development.js:3:21)
    at Module._compile (/home/rails6/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
    at Module.load (internal/modules/cjs/loader.js:822:32)
    at Function.Module._load (internal/modules/cjs/loader.js:730:14)
    at Module.require (internal/modules/cjs/loader.js:864:19)
    at require (/home/rails6/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at WEBPACK_OPTIONS (/home/rails6/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
    at requireConfig (/home/rails6/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
    at /home/rails6/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
    at Array.forEach (<anonymous>)
    at module.exports (/home/rails6/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
    at /home/rails6/node_modules/webpack-cli/bin/cli.js:71:45
    at Object.parse (/home/rails6/node_modules/yargs/yargs.js:567:18)
    at /home/rails6/node_modules/webpack-cli/bin/cli.js:49:8
    at Object.<anonymous> (/home/rails6/node_modules/webpack-cli/bin/cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:971:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
    at Module.load (internal/modules/cjs/loader.js:822:32)
    at Function.Module._load (internal/modules/cjs/loader.js:730:14)
    at Module.require (internal/modules/cjs/loader.js:864:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/rails6/node_modules/webpack/bin/webpack.js:156:2)

Completed 500 Internal Server Error in 1681ms (ActiveRecord: 8.3ms | Allocations: 175316)

任何提示如何解决? 预先感谢。

0 个答案:

没有答案