简体   繁体   中英

How to install socket.io and mysql on Node.js

I'm too newbie to Node.js.

I'm trying to setup a basic site (in order to learn), to make a call from Javascript in front end to Node.js and return the data of a mysql query.

I followed some tutorials in internet and I made this packages.json file

{
    "name": "Stock",
    "version": "0.0.1",
    "devDependencies": {
        "grunt": "~0.4.5",
        "grunt-contrib-watch": "^0.6.1",
        "grunt-execute": "^0.2.2",
        "socket.io":"lastest"
    }
}

Then on my Linux I run: npm install Which I understand it will install all dependencies listed on the packages.json. But I'm getting this error:

npm WARN package.json Stock@0.0.1 No description
npm WARN package.json Stock@0.0.1 No repository field.
npm WARN package.json Stock@0.0.1 No README data
npm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/socket.io
npm ERR! Error: No compatible version found: socket.io@'lastest'
npm ERR! Valid install targets:
npm ERR! ["0.3.8","0.4.0","0.4.1","0.5.1","0.5.3","0.6.0","0.6.1","0.6.3","0.6.4","0.6.5","0.6.6","0.6.7","0.6.8","0.6.9","0.6.10","0.6.11","0.6.12","0.6.14","0.6.15","0.6.16","0.6.17","0.6.18","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","0.7.5","0.7.6","0.7.7","0.7.8","0.7.9","0.7.10","0.7.11","0.8.0","0.8.1","0.8.2","0.8.3","0.8.4","0.8.5","0.8.6","0.8.7","0.9.0","0.9.1","0.9.1-1","0.9.2","0.9.3","0.9.4","0.9.5","0.9.6","0.9.7","0.9.8","0.9.9","0.9.10","0.9.11","0.9.12","0.9.13","0.9.14","0.9.15","0.9.16","1.0.0-pre","1.0.0-pre2","1.0.0-pre3","1.0.0-pre4","1.0.0-pre5","0.9.17","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.1.0","1.2.0","1.2.1","1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3.7"]
npm ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:719:10)
npm ERR!     at /usr/share/npm/lib/cache.js:638:10
npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR!     at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR!     at Object.oncomplete (fs.js:107:15)
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 Linux 3.19.0-31-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pablo/Documents/clients/stock/node
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pablo/Documents/clients/stock/node/npm-debug.log
npm ERR! not ok code 0

I guess latest version for socket.io, is not ok? how would it work?

Part of the code I get from Here

You have a typo in the socket.io version. "socket.io":"lastest" should be changed to "socket.io":"latest" .

应该是“最新的”而不是“最新的”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM