我正在尝试关注Phoenix框架的Up and Running指南。我使用的是Windows 8.1,以下是软件版本:
当我运行命令mix phoenix.new hello_phoenix
时,在我创建应用程序期间Y
Fetch and install dependencies? [Yn] y
之后,我发现控制台中出现以下错误(也可在npm-debug.log
中找到)
...
npm http GET https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz
npm http 200 https://registry.npmjs.org/uid2/-/uid2-0.0.2.tgz
npm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz
npm http 200 https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz
[eval]:1
"require('fs').readdir('lib',function(e){e&&require('child_process').exec('npm
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected token ILLEGAL
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:532:25)
at startup (node.js:80:7)
at node.js:901:3
npm ERR! weird error 8
npm ERR! Error: ENOENT, lstat 'C:\Users\srikps\AppData\Local\Temp\npm-12976\1437663559041-0.8095405038911849\package\src\libsass\subset_map.hpp'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd E:\elixir\hello_phoenix
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! path C:\Users\srikps\AppData\Local\Temp\npm-12976\1437663559041-0.8095405038911849\package\src\libsass\subset_map.hpp
npm ERR! fstream_path C:\Users\srikps\AppData\Local\Temp\npm-12976\1437663559041-0.8095405038911849\package\src\libsass\subset_map.hpp
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http GET https://registry.npmjs.org/os-homedir
npm http GET https://registry.npmjs.org/os-tmpdir
npm http GET https://registry.npmjs.org/xtend
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/is-finite
npm http GET https://registry.npmjs.org/leven
npm http GET https://registry.npmjs.org/get-stdin
如果我尝试使用命令mix phoenix.server
运行应用程序,我会看到以下错误
E:\elixir\hello_phoenix>mix phoenix.server
[info] Running HelloPhoenix.Endpoint with Cowboy on port 4000 (http)
module.js:340
throw err;
^
Error: Cannot find module 'e:\elixir\hello_phoenix\node_modules\brunch\bin\brunch'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
如果我访问http://localhost:4000,该页面看起来不像it should look like,而是看起来像这样:
我还尝试运行Phoenix Issue Page
中提到的命令rm -rf node_modules
npm cache clean
npm install
然而,我又收到了一个错误:
...
npm http 200 https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.1.tgz
npm http 200 https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
> brunch@1.8.3 postinstall E:\elixir\hello_phoenix\node_modules\brunch
> node -e "require('fs').readdir('lib',function(e){e&&require('child_process').exec('npm run prepublish')})"
[eval]:1
"require('fs').readdir('lib',function(e){e&&require('child_process').exec('npm
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected token ILLEGAL
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:532:25)
at startup (node.js:80:7)
at node.js:901:3
unbuild brunch@1.8.3
npm http 200 https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz
npm http 200 https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz
npm http 200 https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz
...
答案 0 :(得分:2)
我相信Phoenix至少需要node.js版本0.12.0。