当 运行 纱线在 nixos 上时,elm-make 无法编译
elm-make fails to compile when running with yarn on nixos
我在 nixos
上与 yarn
合作的 elm
项目无法编译。这个项目为我使用 macOS 的同事编译成功;也许在我的机器上编译失败与我使用NixOS有关。
当我 运行 $ yarn start
我得到以下终端输出:
$ yarn start
yarn start v0.20.3
$ webpack-dev-server --env dev
env dev
Project is running at http://0.0.0.0:3000/
webpack output is served from /
Content not from webpack is served from /home/matthew/backup/azara_work/platform/web/src
404s will fallback to /index.html
Running elm-make /home/matthew/backup/azara_work/platform/web/src/App.elm --yes --warn --debug --output /tmp/117814-7766-1wq3nh5.xanii6yldi.js
当我尝试在 http://0.0.0.0:3000/
加载页面时,我的浏览器控制台显示以下错误:
VM1496:1 Uncaught Error: Module build failed: Error: Compiler process exited with error Compilation failed
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
at eval (eval at ./src/App.elm (http://0.0.0.0:3000/index.js:4316:1), <anonymous>:1:7)
at Object../src/App.elm (http://0.0.0.0:3000/index.js:4316:1)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
at fn (http://0.0.0.0:3000/index.js:86:20)
at eval (eval at ./src/index.js (http://0.0.0.0:3000/index.js:4324:1), <anonymous>:7:13)
at Object../src/index.js (http://0.0.0.0:3000/index.js:4324:1)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
at fn (http://0.0.0.0:3000/index.js:86:20)
at Object.0 (http://0.0.0.0:3000/index.js:4333:18)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
和
./src/App.elm
Module build failed: Error: Compiler process exited with error Compilation failed
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
@ ./src/index.js 2:12-32
@ multi (webpack)-dev-server/client?http://0.0.0.0:3000 webpack/hot/dev-server ./src/index.js
看来问题可能与 elm-make
有关,因为这两个错误都出现了。我的路径在
找到 elm-make
$ which elm-make
/home/matthew/.nix-profile/bin/elm-make
与错误报告它试图查找的路径不同的位置 elm-make
(/home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make
)。我想知道这是否与问题有关。
在错误中列出的目录中,elm-make
在通过 ls
列出时确实存在:
$ ls /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/
elm elm-make elm-package elm-reactor elm-repl
但是,当我尝试 运行 yarn start
输出中列出的命令时,除了在此节点模块路径中用 elm-make 替换 elm-make
外,我得到'No such file or directory' 错误。
$ ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make /home/matthew/backup/azara_work/platform/web/src/App.elm --yes --warn --debug --output /tmp/117814-7422-1p5ad15.q2uqqzd7vi.js
-bash: ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make: No such file or directory
当通过 ls
列出时可执行文件清晰可见时,为什么我在尝试 运行 此 'node-modules' elm-make
时会出现此 'No such file or directory' 错误?
是不是我的路径elm-make
和'node-modules'下的路径位置不一样导致编译失败?也许纱线用错了。如果是这样,我如何设置 yarn 以使用正确的 elm-make
?
如何才能 yarn start
成功编译项目?
非常感谢您的建议;我已经坚持了一段时间。
我建议您为 NixOS 选择安装 elm(以某种方式)。如果你创建一个每个人都使用的 shell.nix 并且完全避免通过 npm 依赖 nix,通常是最简单的。
elm-make 不存在的原因是 ELF 解释器,它位于 NixOS 的不同位置。
尝试ldd ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make
快速修复是将 ls -la $(nix-build -A elmPackages.elm '<nixpkgs>')/bin
中的所有二进制文件符号链接到您的 cabal 沙箱。
我在 nixos
上与 yarn
合作的 elm
项目无法编译。这个项目为我使用 macOS 的同事编译成功;也许在我的机器上编译失败与我使用NixOS有关。
当我 运行 $ yarn start
我得到以下终端输出:
$ yarn start
yarn start v0.20.3
$ webpack-dev-server --env dev
env dev
Project is running at http://0.0.0.0:3000/
webpack output is served from /
Content not from webpack is served from /home/matthew/backup/azara_work/platform/web/src
404s will fallback to /index.html
Running elm-make /home/matthew/backup/azara_work/platform/web/src/App.elm --yes --warn --debug --output /tmp/117814-7766-1wq3nh5.xanii6yldi.js
当我尝试在 http://0.0.0.0:3000/
加载页面时,我的浏览器控制台显示以下错误:
VM1496:1 Uncaught Error: Module build failed: Error: Compiler process exited with error Compilation failed
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
at eval (eval at ./src/App.elm (http://0.0.0.0:3000/index.js:4316:1), <anonymous>:1:7)
at Object../src/App.elm (http://0.0.0.0:3000/index.js:4316:1)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
at fn (http://0.0.0.0:3000/index.js:86:20)
at eval (eval at ./src/index.js (http://0.0.0.0:3000/index.js:4324:1), <anonymous>:7:13)
at Object../src/index.js (http://0.0.0.0:3000/index.js:4324:1)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
at fn (http://0.0.0.0:3000/index.js:86:20)
at Object.0 (http://0.0.0.0:3000/index.js:4333:18)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
和
./src/App.elm
Module build failed: Error: Compiler process exited with error Compilation failed
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
@ ./src/index.js 2:12-32
@ multi (webpack)-dev-server/client?http://0.0.0.0:3000 webpack/hot/dev-server ./src/index.js
看来问题可能与 elm-make
有关,因为这两个错误都出现了。我的路径在
elm-make
$ which elm-make
/home/matthew/.nix-profile/bin/elm-make
与错误报告它试图查找的路径不同的位置 elm-make
(/home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make
)。我想知道这是否与问题有关。
在错误中列出的目录中,elm-make
在通过 ls
列出时确实存在:
$ ls /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/
elm elm-make elm-package elm-reactor elm-repl
但是,当我尝试 运行 yarn start
输出中列出的命令时,除了在此节点模块路径中用 elm-make 替换 elm-make
外,我得到'No such file or directory' 错误。
$ ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make /home/matthew/backup/azara_work/platform/web/src/App.elm --yes --warn --debug --output /tmp/117814-7422-1p5ad15.q2uqqzd7vi.js
-bash: ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make: No such file or directory
当通过 ls
列出时可执行文件清晰可见时,为什么我在尝试 运行 此 'node-modules' elm-make
时会出现此 'No such file or directory' 错误?
是不是我的路径elm-make
和'node-modules'下的路径位置不一样导致编译失败?也许纱线用错了。如果是这样,我如何设置 yarn 以使用正确的 elm-make
?
如何才能 yarn start
成功编译项目?
非常感谢您的建议;我已经坚持了一段时间。
我建议您为 NixOS 选择安装 elm(以某种方式)。如果你创建一个每个人都使用的 shell.nix 并且完全避免通过 npm 依赖 nix,通常是最简单的。
elm-make 不存在的原因是 ELF 解释器,它位于 NixOS 的不同位置。
尝试ldd ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make
快速修复是将 ls -la $(nix-build -A elmPackages.elm '<nixpkgs>')/bin
中的所有二进制文件符号链接到您的 cabal 沙箱。