codecombat / codecombat

Game for learning how to code.
http://codecombat.com
MIT License
7.98k stars 4.13k forks source link

"Failed to install node packages" #98

Closed epaga closed 10 years ago

epaga commented 10 years ago

Tried installing and ran into the following error in step 4. I assume manually reinstalling node should fix things, but since the error message said to contact you, I'm doing this. :)

>sudo python ./coco/scripts/devSetup/setup.py
Password:
Code Combat Development Environment Setup Script
Mac detected, architecture: 64 bit
Ruby found.
/bin/sh: mongod: command not found
Mongod not found.
MongoDB 2.5.4 not found, so installing...
Downloading MongoDB from URL http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.5.4.tgz
[######################################################################] 100.0% 
Decompressing MongoDB...
Decompressed MongoDB into /Users/johngoering/codecombat/coco/bin/tmp/mongo
Downloading Node from URL http://nodejs.org/dist/v0.10.24/node-v0.10.24-darwin-x64.tar.gz
[######################################################################] 100.1% 
Decompressing Node...
Decompressed Node into /Users/johngoering/codecombat/coco/bin/tmp/node
A previous version of npm has been found. 
You may experience problems if you have a version of npm that's too old.Would you like to upgrade?(y/n) 
y
Retrieving npm update script...
Retrieved npm install script. Executing...
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@1.1
fetching: http://registry.npmjs.org/npm/-/npm-1.1.71.tgz
0.8.16
1.1.71
cleanup prefix=/usr/local

All clean!
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@1.1.71 /usr/local/lib/node_modules/npm
It worked
Updated npm version installed
Installing node packages...
npm ERR! install Couldn't read dependencies
npm ERR! Error: no version
npm ERR!     at validVersion (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:580:32)
npm ERR!     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:342:23)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:140:33
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:335:40
npm ERR!     at fs.readFile (fs.js:176:14)
npm ERR!     at fs.close (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:90:5)
npm ERR!     at Object.oncomplete (fs.js:297: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 Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/johngoering/codecombat/coco
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.71
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/johngoering/codecombat/coco/npm-debug.log
npm ERR! not ok code 0
Traceback (most recent call last):
  File "./coco/scripts/devSetup/setup.py", line 46, in <module>
    setup.setup()
  File "/Users/johngoering/codecombat/coco/scripts/devSetup/factories.py", line 71, in setup
    super(self.__class__, self).setup()
  File "/Users/johngoering/codecombat/coco/scripts/devSetup/factories.py", line 48, in setup
    self.repoCloner.install_node_packages()
  File "/Users/johngoering/codecombat/coco/scripts/devSetup/repositoryInstaller.py", line 68, in install_node_packages
    raise errors.CoCoError(u"Failed to install node packages")
errors.CoCoError: u'Failed to install node packages\n Please contact CodeCombat support, and include this error in your message.'
epaga commented 10 years ago

When I manually installed the latest node.js and reran the python script, this is what happened:

sudo python ./coco/scripts/devSetup/setup.py
Password:
Code Combat Development Environment Setup Script
Traceback (most recent call last):
  File "./coco/scripts/devSetup/setup.py", line 45, in <module>
    setup = factories.constructSetup()
  File "/Users/johngoering/codecombat/coco/scripts/devSetup/factories.py", line 16, in constructSetup
    config = configuration.Configuration()
  File "/Users/johngoering/codecombat/coco/scripts/devSetup/configuration.py", line 11, in __init__
    self.directory.create_base_directories()
  File "/Users/johngoering/codecombat/coco/scripts/devSetup/directoryController.py", line 39, in create_base_directories
    raise errors.CoCoError(u"There was an error creating the directory structure, do you have correct permissions? Please remove all and start over.")
errors.CoCoError: u'There was an error creating the directory structure, do you have correct permissions? Please remove all and start over.\n Please contact CodeCombat support, and include this error in your message.'
epaga commented 10 years ago

Removed everything, tried again. When it asked whether or not to update node I said no (since I already have the latest node afaik - 0.10.24 - and now the script ran through flawlessly.

schmatz commented 10 years ago

Hey epaga, thanks for reporting this issue! I'll look into it today.

schmatz commented 10 years ago

I've fixed this issue, and will push the changes tomorrow after testing. Thanks again for reporting it!

schmatz commented 10 years ago

@epaga, are you using a tool like nvm?

It appears as if the problem occurs on Ubuntu too when an old version of node is installed, as when the script is run as sudo the paths change(based on how Ubuntu builds sudo). It then appears to the script as not installed, the script tries to install the latest version, and then npm runs and sees the old version installed. Rather than fix it for both platforms in the script itself, I'm going to edit the initial bash script to check for old versions of node instead and warn at that step.

jequal commented 10 years ago

You are installing node0.8.16 by what method? Package is compiled it?

jequal commented 10 years ago

The implementation of "sudo python ./coco/scripts/devSetup/setup.py" installation, suggesting that "/ usr / local / lib" does not find node, after the installation is complete, suggesting that "npm WARN engine coffee-script-redux@2.0. 0-beta4: wanted: {"node": "0.6.x || 0.8.x"} (current: {"node": "0.10.24", "npm": "1.4.23"}) "

Browser to open localhost: 3000, prompted JScript error!

I need people to help, thank you!

jequal commented 10 years ago

js-bson: Failed to load c++ bson extension, using pure JS version

nwinter commented 10 years ago

@dmc56111 it may be easier to debug this with a bit of back-and-forth in our HipChat room.

jequal commented 10 years ago

My country is China, see codecombat very interested, and I want to promote in China, but encountered a problem, I do not know how to solve! Problem Description: Browser http: // localhost: 3000 load script fails, an error message:

error: error loading script

error: uncaught exception: error: invalid argument

check the js console for more

jequal commented 10 years ago

Server load 404, what is the solution! GET /file/db/level/5391f3d519dc22b8082159b2/banner2.png 404 91ms - 10 GET /file/db/level/53173f76c269d400000543c2/Level%20Banner%20Dungeon%20Arena.jpg 404 90ms - 10 GET /images/favicon.ico 304 8ms GET /file/db/level/533353722a61b7ca6832840c/Gold-Rush.png 404 109ms - 10 GET /file/db/level/53558b5a9914f5a90d7ccddb/greed_banner.jpg 404 114ms - 10 GET /file/db/level/53c80fce0ddbef000084c667/sky-Span-banner.jpg 404 117ms - 10 GET /file/db/level/52d97ecd32362bc86e004e87/Level%20Banner%20Brawlwood.jpg 404 51ms - 10 GET /db/user/53f7d8637a6574bb0a97235c/level.sessions?project=state.complete,levelID 200 185ms - 2 GET /file/db/level/5391f3d519dc22b8082159b2/banner2.png 404 3ms - 10 GET /file/db/level/53558b5a9914f5a90d7ccddb/greed_banner.jpg 404 3ms - 10 GET /file/db/level/53c80fce0ddbef000084c667/sky-Span-banner.jpg 404 7ms - 10 GET /file/db/level/53173f76c269d400000543c2/Level%20Banner%20Dungeon%20Arena.jpg 404 3ms - 10 GET /file/db/level/533353722a61b7ca6832840c/Gold-Rush.png 404 3ms - 10

nwinter commented 10 years ago

@jequal have you updated with the latest database dump?

jequal commented 10 years ago

@nwinter What instruction execution ah!

coco-update-treema coco-update-createjs

nwinter commented 10 years ago

This part:

Download the public CodeCombat MongoDB sandbox copy backup (updated every 10 minutes) and import it into your locally running database with the following steps.

  1. Make sure the database is running on your computer (./bin/coco-mongodb).
  2. If the backup file is compressed, uncompress it (for instance, if it is a .tar.gz file, run tar xzvf [filename])
  3. Step 2 should generate a dump folder. To import this run mongorestore --drop [path to dump] if mongorestore is in your path. If it's not and you used the script, run [path to CodeCombat folder]/bin/mongo/mongorestore --drop [path to dump]

When downloading a new dump to keep the database up-to-date, use mongorestore --drop [path to dump] to clear out all old data (including any local data you have created) and replace with just the new data.

jequal commented 10 years ago

@nwinter Thank you very much, 404 issues have been resolved! However, problems still exist, browsing "http: // localhost: 3000" The following error occurred: error: error loading script check the js console for more

Are told what the problem is?

nwinter commented 10 years ago

I'd need the stack trace from the JS console to say for sure. But did these things happen without error?

  1. npm install
  2. bower install
  3. bin/coco-brunch
  4. bin/coco-mongodb
  5. bin/coco-dev-server

If all those things worked, then the dev environment should be ready to go to http://localhost:3000.

jequal commented 10 years ago

I was under schmatz video installation, but also tried many times and the results are the same,

jequal commented 10 years ago

image

nwinter commented 10 years ago

When you see that message, you should open the JS console to see what the error is, then click the red triangle next to the error to expand the stack trace, then tell me what the stack trace is.

nwinter commented 10 years ago

Oh, I see, now. It's trying to load various fonts, analytics tools, and social network SDKs, but it can't find any of them because either 1) your internet can't access them or 2) they don't apply to domains that aren't codecombat.com or localhost (like LinkedIn). It should still work to use the local dev site, though, so you could ignore that first error message that shows up.

nwinter commented 10 years ago

Does your bin/coco-dev-server show any error messages when it gives you those 502s?

jequal commented 10 years ago

Failed to load resource: the server responded with a status of 404 (Not Found) http://192.168.10.127:3000/file/db/thang.type/529ffbf1cf1818f2be000001/sword_attack_1.mp3 Failed to load resource: the server responded with a status of 404 (Not Found) http://192.168.10.127:3000/file/interface/level_loaded.mp3 Level unveiled after 16.38s app.js:81589 Built sheet: Wizard 8445ms Async app.js:39724 Built sheet: Ogre Munchkin 988ms Async app.js:39724 Built sheet: Tharin 1172ms Async app.js:39724 GET https://oauth.googleusercontent.com/gadgets/js/core:rpc:shindig.random:shindig.sha1.js?c=2 net::ERR_CONNECTION_TIMED_OUT postmessageRelay:1 GET https://oauth.googleusercontent.com/gadgets/js/core:rpc:shindig.random:shindig.sha1.js?c=2 net::ERR_CONNECTION_TIMED_OUT postmessageRelay:1 Uncaught ReferenceError: gadgets is not defined 682094929-postmessagerelay.js:9 1.N 682094929-postmessagerelay.js:9 1.J 682094929-postmessagerelay.js:9

nwinter commented 10 years ago

It would be easier to debug this over here: http://www.hipchat.com/g3plnOKqa

jequal commented 10 years ago

Can you give me a remote look?