phoenixframework / phoenix

Peace of mind from prototype to production
https://www.phoenixframework.org
MIT License
21.41k stars 2.87k forks source link

[error]Could not start watcher because "node" is not available. #2936

Closed chenjianxin closed 6 years ago

chenjianxin commented 6 years ago

Environment

Expected behavior

I have do ...

  1. cd asserts
  2. npm install
  3. node node_modules/brunch/bin/brunch build

Actual behavior

PS D:\HA\hello> mix phx.server =INFO REPORT==== 27-Jun-2018::16:42:00.780000 === application: logger exited: stopped type: temporary [info] Running HelloWeb.Endpoint with Cowboy using http://0.0.0.0:4000 [error] Could not start watcher because "node" is not available. Your Phoenix application is still running, however assets won't be compiled. You may fix this by installing "node" and then running "cd assets && npm install". node node_modules/brunch/bin/brunch build[info] GET / [debug] Processing with HelloWeb.PageController.index/2 Parameters: %{} Pipelines: [:browser] [info] Sent 200 in 63ms

it seems to be working fine.......I am confusing

gialib commented 6 years ago

You may fix this by installing "node" and then running "cd assets && npm install" link https://nodejs.org/en/download/

chrismccord commented 6 years ago

It sounds like you did not follow the instructions, or perhaps they failed when you answered "Y" to fetch and install deps?

I have do ...

cd asserts npm install node node_modules/brunch/bin/brunch build

Can you perform those steps? If they work, that error will be gone when you run mix phx.server, if they fail, please share the error message. Thanks!

chenjianxin commented 6 years ago

@chrismccord
I did it again

1. mix phx.new renew

creating............. .............................. Fetch and install dependencies? [Yn] Y

The command listed next expect that you have npm available. If you don't want brunch.io, you can re-run this generator with the --no-brunch option.

We are almost there! The following steps are missing:

$ cd renew
$ cd assets && npm install && node node_modules/brunch/bin/brunch build

Then configure your database in config/dev.exs and run:

$ mix ecto.create

Start your Phoenix app with:

$ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

$ iex -S mix phx.server 

2. cd renew && cd asserts && npm install

npm WARN deprecated babel-preset-latest@6.24.1: We're super � excited that you're trying to use ES2017+ syntax, but instead of making more yearly presets � , Babel now has a better preset that we recommend you use instead: npm install babel-preset-env --save-dev. preset-env without options will compile ES2015+ down to ES5 just like using all the presets together and thus is more future proof. It also allows you to target specific browsers so that Babel can do less work and you can ship native ES2015+ to user � ! We are also in the process of releasing v7, so please give http://babeljs.io/blog/2017/09/12/planning-for-7.0 a read a nd help test it out in beta! Thanks so much for using Babel �, please give us a follow on Twitter @babeljs for news on Babel, join slack.babeljs.io for discuss ion/development and help support the project at opencollective.com/babel npm WARN deprecated coffee-script@1.11.1: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) npm WARN deprecated babel-preset-es2016@6.24.1: � Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! npm WARN deprecated babel-preset-es2015@6.24.1: � Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! npm WARN deprecated babel-preset-es2017@6.24.1: � Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN assets No description npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

3. node node_modules/brunch/bin/brunch build

20:56:35 - info: compiled 6 files into 2 files, copied 3 in 2.9 sec

4. mix ecto.create

The database for Renew.Repo has been created

5. mix phx.server

=INFO REPORT==== 27-Jun-2018::20:59:44.769000 === application: logger exited: stopped type: temporary [info] Running RenewWeb.Endpoint with Cowboy using http://0.0.0.0:4000 [error] Could not start watcher because "node" is not available. Your Phoenix application is still running, however assets won't be compiled. You may fix this by installing "node" and then running "cd assets && npm install". [info] GET / [debug] Processing with RenewWeb.PageController.index/2 Parameters: %{} Pipelines: [:browser] [info] Sent 200 in 93ms

chrismccord commented 6 years ago

This looks like a windows 10 issue with not being able to find node, which is odd since you clearly have it installed. We invoke System.cmd("node", [...]) more or less from your watcher config so nothing too fancy there with respect to paths or environment. If you D:\HA\hello> node -v does it print the version?

michalmuskala commented 6 years ago

It seems this is the same issue as https://github.com/elixir-lang/elixir/issues/7774 - a bug in OTP 21. It's fixed in 21.0.1

josevalim commented 6 years ago

Ah, good call @michalmuskala. A new Windows installer was also made available by the OTP team: http://www.erlang.org/downloads

chenjianxin commented 6 years ago

@chrismccord yes PS D:\HA\hello> node -v v9.9.0

chenjianxin commented 6 years ago

@michalmuskala It is working after I install OTP 21.0.1

PS D:\HA\renew> mix phx.server =INFO REPORT==== 28-Jun-2018::16:29:49.634000 === application: logger exited: stopped type: temporary [info] Running RenewWeb.Endpoint with Cowboy using http://0.0.0.0:4000 16:30:06 - info: compiling 16:30:08 - info: compiled 6 files into 2 files, copied 3 in 13.8 sec [info] GET / [debug] Processing with RenewWeb.PageController.index/2 Parameters: %{} Pipelines: [:browser] [info] Sent 200 in 188ms

josevalim commented 6 years ago

Awesome! Glad to have it solved! :tada:

subsoap commented 6 years ago

I had same issue, installing OTP 21.0.1 also helped.

hopewise commented 5 years ago

I am having the same issue:

╰─ erl -v                                                                                                                                                    10167  16:06:15
Erlang/OTP 22 [erts-10.4.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]

Eshell V10.4.1

╰─ node -v                                                                                                                                                   10168  16:06:40
v10.10.0