While developing a Meteor application on Windows, the Meteor command suddenly fails to start the meteor application with an error like:
C:\Users\eskopal\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:280
throw(ex);
^
Error: Cannot find module 'websocket-extensions'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\eskopal\AppData\Local\.meteor\packages\ddp-server\1.3.13\npm\node_modules\sockjs\node_modules\faye-websocket\node_modules\websocket-driver\lib\websocket\driver\hybi.js:5:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
This can occur from hours to days after a fresh install of Meteor. I have tracked it down to updates of the node_packages for the meteor_tool. But, I have not called for any updates. At this point any Meteor command gets the same error.
I have not been able to track down where or why these updates are initiated.
So far, my solution is to return the C:\users\username\AppData\Local.meteor directory to its original state with a few batch files. I am running Windows 8.1 and using WebStorm for development. The production application runs on Ubuntu Server and does not experience this issue.
Due to the windows limit of 255 character file paths you have to use robocopy to copy, compare, and delete the directories. This is the sixth time I have updated meteor and made a new backup.
Batch Files:
To make an initial copy after installing Meteor and updating everything:
_C:\Users\ESkopal\AppData\Local\backupMeteor.bat
robocopy .meteor .meteor-working6 /NFL /NDL /S /E /PURGE /MIR /R:1 /W:1
To Verify that something is wrong β and identify what files have changed:
C:\Users\ESkopal\AppData\Local_checkMeteor.bat
#check if there are any changes
robocopy .meteor .meteor-working6 /NP /FP /NDL /L /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1 /W:1
To Restore the directory so I can keep working:
C:\Users\ESkopal\AppData\Local\_restoreMeteor.bat
robocopy .meteor-working6 .meteor /NFL /NDL /S /E /PURGE /MIR /R:1 /W:1
To Delete old backup directories:
_C:\Users\ESkopal\AppData\Local\restoreMeteor.bat
mkdir _empty_dir
robocopy _empty_dir .meteor-working5 /s /mir
rmdir .meteor-working5
rmdir _empty_dir
I posted this to help anyone else experiencing this problem. And to ask if any has any idea what is going wrong?