2016-02-09 56 views
0

Im遵循教程here。我在此時試圖運行該項目。我得到一個錯誤,說沒有定義的模板引擎。本教程讓我們刪除app.useAzure Node.JS教程默認模板引擎

以下是我嘗試瀏覽本教程時出現的控制檯錯誤。只是爲了確定我回到了三次。我犯了同樣的錯誤。我注意到在History.md中已經解決了這個問題,但是我無法弄清楚如果我應該對這些信息做任何事情。你能建議嗎?

這是教程:https://azure.microsoft.com/en-us/documentation/articles/documentdb-nodejs-application/

我得到試圖NPM運行開始看到TODO UI錯誤。當我在本教程開始時運行start時,它可以正常工作。

謝謝。


Kaona (master *) todo $ npm start 
> [email protected] start /Users/Kaona/GitHub/todo 

> node ./bin/www 



/Users/Kaona/GitHub/todo/node_modules/express/lib/view.js:62 

    throw new Error('No default engine was specified and no extension was provided.'); 

    ^



Error: No default engine was specified and no extension was provided. 

    at new View (/Users/Kaona/GitHub/todo/node_modules/express/lib/view.js:62:11) 

    at EventEmitter.render (/Users/Kaona/GitHub/todo/node_modules/express/lib/application.js:569:12) 

    at ServerResponse.render (/Users/Kaona/GitHub/todo/node_modules/express/lib/response.js:961:7) 

    at /Users/Kaona/GitHub/todo/routes/tasklist.js:27:17 

    at /Users/Kaona/GitHub/todo/models/taskDao.js:43:17 

    at Base.defineClass._toArrayImplementation (/Users/Kaona/GitHub/todo/node_modules/documentdb/lib/queryIterator.js:187:17) 

    at /Users/Kaona/GitHub/todo/node_modules/documentdb/lib/queryIterator.js:183:26 

    at /Users/Kaona/GitHub/todo/node_modules/documentdb/lib/queryIterator.js:234:17 

    at successCallback (/Users/Kaona/GitHub/todo/node_modules/documentdb/lib/documentclient.js:2069:17) 

    at IncomingMessage.<anonymous> (/Users/Kaona/GitHub/todo/node_modules/documentdb/lib/request.js:84:13) 

回答

0

根據錯誤,我猜你的機器是一臺Mac,但我想我下面的步驟,在Linux上這是在MacOS和你的相似。

本教程示例顯示了由快速生成器爲使用Azure DocumentDB而創建的本地節點應用程序。

因此,第一步是在Azure新門戶上創建Azure DocumentDB實例。我認爲這很簡單,並複製爲快速應用程序創建的DocumentDB的連接信息。

要創建一個像教程這樣的快速應用程序,我做了以下步驟。

  1. 命令npm install express-generator -g

    在MacOS上,可能需要添加前綴CMD sudo,因爲它是全球ENV,見http://expressjs.com/en/starter/generator.html)。

  2. 命令express todo

    生成可通過快遞發電機空特快應用

  3. 命令cd todo && npm install

    安裝的依賴庫在package.json

  4. 臨時會員現在10
  5. ,你可以命令在dir todonpm start和瀏覽從GitHub項目https://github.com/Azure-Samples/documentdb-node-todo-app網址http://localhost:3000
  6. 命令git clone https://github.com/Azure-Samples/documentdb-node-todo-app.git和文件複製混帳回購協議的路徑src到DIR todo
  7. 編輯&使用DocumentDB的連接信息配置config.js

希望它有幫助。最好的祝福。