2017-09-14 10 views
2

プロジェクトyarnで作業中ですnixos私はコンパイルできません。このプロジェクトは、macOSを使用している同僚のために正常にコンパイルされます。私のマシンでコンパイルできなかったのは、私が使っているNixOSに関係しているのかもしれません。nixosで糸を使って実行しているときにelm-makeがコンパイルに失敗する

私は$ 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/home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make)を見つけようとしている報告しているパスとは別の場所である

$ which elm-make 
/home/matthew/.nix-profile/bin/elm-make 

elm-makeを見つけました。それが問題に関連しているのではないかと思います。

エラーに記載されているディレクトリで、elm-makelsを経由して一覧表示する際に存在するように見えるん:しかし

$ 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 

、私はelm-makeを交換する以外、yarn startの出力にリストされたコマンドを実行しようこのノードモジュールのパスで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 

実行しようとしたとき、私はこの「そのようなファイルまたはディレクトリ」というエラーを取得していないかもしれませんなぜこの「ノード・モジュールのelm-makelsを経由して一覧表示する際実行ファイルがはっきりと見えるのですか?

私のパスのelm-makeと 'node-modules'の下のパスの場所が異なるため、コンパイルに失敗しましたか?おそらく糸が間違ったものを使用しています。もしそうなら、正しい糸を使用するように糸を設定するにはどうすればいいですか?elm-make

yarn startでプロジェクトを正しくコンパイルするにはどうすればよいですか?

アドバイスありがとうございます。私はしばらくこれに固執してきた。

答えて

3

NixOSの場合、elmのインストールをオプション(何とか)にすることをお勧めします。あなたがshell.nixを作成して誰もが使用し、npm経由でnixに依存しないようにすれば、通常は最も簡単です。

elm-makeが存在しないのは、NixOSの別の場所にあるELFインタプリタのためです。

ldd ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make

クイックフィックスがあなたの秘密結社のサンドボックスにls -la $(nix-build -A elmPackages.elm '<nixpkgs>')/bin内のすべてのバイナリをシンボリックリンクすることです試してみてください。

+1

シンボリックリンク '$ ln -s/home/matthew /を作成する。/ home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin'からnix-profile/bin/elm-makeを実行します。ありがとうございました! – mherzl

関連する問題