kdchang / reactjs101

從零開始學 ReactJS(ReactJS 101)是一本希望讓初學者一看就懂的 React 中文入門教學書,由淺入深學習 ReactJS 生態系 (Flux, Redux, React Router, ImmutableJS, React Native, Relay/GraphQL etc.)。
https://www.gitbook.com/book/kdchang/react101/details
Other
4.31k stars 1.22k forks source link

CH10 美食分享範例Code無法順利執行( bcrypt 0.8.7 在win10上的問題 ) #37

Closed Crygar closed 8 years ago

Crygar commented 8 years ago

  您好,首先感謝您編輯了這麼一本好書,著實獲益良多。以下是我的問題:

  我在執行ch10美食分享範例時,由於win10環境下執行npm install指令會有其中一項bcrypt 0.8.7無法安裝,即使照著nodejs/node-gyp的操作,依然無法解決問題。

On Windows: Option 2: --Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.   💡 [Windows Vista / 7 only] requires .NET Framework 4.5.1

--Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7 (or see below for further instructions on specifying the proper Python version and path.)

--Launch cmd, npm config set msvs_version 2015

  由於一直無法解決bcrypt 0.8.7安裝問題索性尋找bcryptjs作為替代方案,在package.json刪除bcrypt 0.8.7並手動npm install bcryptjs後直接npm start,一樣沒解決問題,顯示訊息與bcrypt 0.8.7沒安裝完成時執行npm start的情況一模一樣。      請問我是不是漏了什麼步驟,亦或是我沒有找到對的解決方法,以至於導致範例code無法順利運行的情況呢?

==> �  Listening on port 3000. Open up http://localhost:3000/ in your browser.

C:\Users\user\Documents\ReactJS\react-router-redux-node-isomorphic-open-cook\node_modules\mongodb\lib\server.js:261
        process.nextTick(function() { throw err; })
                                      ^
MongoError: failed to connect to server [localhost:27017] on first connect
    at Pool.<anonymous> (C:\Users\user\Documents\ReactJS\react-router-redux-node-isomorphic-open-cook\node_modules\mongodb-core\lib\topologies\server.js:313:35)
    at emitOne (events.js:96:13)
    at Pool.emit (events.js:188:7)
    at Connection.<anonymous> (C:\Users\user\Documents\ReactJS\react-router-redux-node-isomorphic-open-cook\node_modules\mongodb-core\lib\connection\pool.js:260:12)
    at Connection.g (events.js:291:16)
    at emitTwo (events.js:106:13)
    at Connection.emit (events.js:191:7)
    at Socket.<anonymous> (C:\Users\user\Documents\ReactJS\react-router-redux-node-isomorphic-open-cook\node_modules\mongodb-core\lib\connection\connection.js:162:49)
    at Socket.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1271:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
[nodemon] app crashed - waiting for file changes before starting...
kdchang commented 8 years ago

@Crygar 您好,謝謝您的肯定,請問您的問題解決了嗎?

Crygar commented 8 years ago

@kdchang 您好,很抱歉這麼晚才回應。

  我後來額外在系統上裝了MongoDB 3.2.10後,cmd -> mongod後可以監聽localhost:3000了,但DB無法連到localhost(shut down後mongod.lock有清空),所以預設的資料跟帳號密碼都沒有寫進去,只看得到view。

P.S bcrypt 0.8.7的問題我改用install bcryptjs解決。

ch10_example_problem3 ch10_example_problem4 ch10_example_problem1 ch10_example_problem2

chienfuchen32 commented 8 years ago

謝謝你的幫助! 我也是使用bcryptjs才跳過windows編譯的錯誤

Crygar commented 8 years ago

@chienfuchen32 很高興自己的經驗能對別人有所幫助 :)

chienfuchen32 commented 8 years ago

@Crygar 你好 我目前是使用Mongoose官方範例 於MongoDB建製作者的user collection才看的到完整的網站功能