Closed mjwheatley closed 8 years ago
Same.
Using Meteor v 1.2.1 and Firefox 44.0.2
These are the packages I'm using:
iron:router
autopublish
less
jquery
twbs:bootstrap
zimme:iron-router-active
natestrauser:animate-css
fortawesome:fontawesome
standard-minifiers
meteor-base
mobile-experience
mongo
blaze-html-templates
session
tracker
logging
reload
random
ejson
spacebars
check
okgrow:router-autoscroll
accounts-password
ian:accounts-ui-bootstrap-3
underscore
natestrauser:x-editable-bootstrap
alanning:roles
meteorhacks:ssr
meteorhacks:npm
npm-container
email
harrison:papa-parse
pfafman:filesaver
TypeError: Cannot read property 'document' of undefined
at saveAs (packages/pfafman_filesaver/lib/FileSaver.js:22:1)
at Package (packages/pfafman_filesaver/lib/FileSaver.js:265:1)
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:302:4
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:311:3
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/boot.js:242:10
at Array.forEach (native)
at Function._.each._.forEach (/home/agstover/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/boot.js:137:5
Exited with code: 8
Please see if the reverting to the older version 0.2.2
, fixed the issue. If so then I will pull out the globalization pull in 0.2.3.
@mjwheatley you should include the relevant info in your issue as @agstover did.
OS, Browser/Version, package list.
thanks
Unfortunately, meteor add pfafman:filesaver@0.2.2
caused the same error.
.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
TypeError: Cannot read property 'document' of undefined
at saveAs (packages/pfafman_filesaver/lib/FileSaver.js:22:1)
at Package (packages/pfafman_filesaver/lib/FileSaver.js:265:1)
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:302:4
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:311:3
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/boot.js:242:10
at Array.forEach (native)
at Function._.each._.forEach (/home/agstover/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /home/agstover/Desktop/lc/.meteor/local/build/programs/server/boot.js:137:5
Exited with code: 8
Same issue with Meteor 1.2.1. Tried both 0.2.2 and 0.2.3.
See if you also get it by placing the filesaver.js js file in your app's client/compatible, and of course remove this package. If that is also the case then it is an issue with your app and filesaver.js and this meteor package is not the cause.
All this package does is wrapper package around filesaver.js. Major editing inside of the filesaver.js is left to the wrapped library.
@Jarskih see if some package you are including is in @agstover list. Also you did not state your browser/os.
I have not seen any issues on Safari or Chrome OS X.
I am using Meteor 1.2.1 with ionic2-meteor (which uses angular2-meteor) and using a combination of typescript files and javascript files.
I am testing on OS X El Capitan Version 10.11.4 using Chrome Version 49.0.2623.110 (64-bit)
These are the packages I'm using:
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-base # Packages every Meteor app needs to have
mongo # The database Meteor supports right now
session # Client-side reactive dictionary for your app
jquery # Helpful client-side library
tracker # Meteor's client-side reactive programming library
#standard-minifiers # JS/CSS minifiers run for production mode
es5-shim # ECMAScript 5 compatibility for older browsers.
# Removed mobile-experience package to fix conflict between fastclick and ionic2
# Re-addeding other packages from mobile-experience
#mobile-experience
launch-screen
mobile-status-bar
accounts-base
accounts-facebook
accounts-google
accounts-password
barbatus:ionic2-meteor
barbatus:ng2-meteor-accounts
chrismbeckett:toastr
crosswalk
email
fortawesome:fontawesome
http
mdg:camera
mdg:geolocation
#mdg:reload-on-resume
meteorhacks:cluster
reactive-var
service-configuration
twbs:bootstrap
tanis:bootstrap-social@0.1.1
tsega:bootstrap3-datetimepicker
mikowals:batch-insert
harrison:papa-parse
meteorhacks:npm
npm-container
And my package versions:
accounts-base@1.2.2
accounts-facebook@1.0.6
accounts-google@1.0.6
accounts-oauth@1.1.8
accounts-password@1.1.4
autoupdate@1.2.4
babel-compiler@5.8.24_1
babel-runtime@0.1.4
barbatus:angular2@0.8.7
barbatus:ionic2-meteor@0.1.7
barbatus:ng2-compilers@0.1.1
barbatus:ng2-meteor-accounts@0.1.6
barbatus:ts-compilers@0.2.9
barbatus:typescript@0.1.5_1
base64@1.0.4
binary-heap@1.0.4
blaze@2.1.3
blaze-tools@1.0.4
boilerplate-generator@1.0.4
caching-compiler@1.0.0
caching-html-compiler@1.0.2
callback-hook@1.0.4
check@1.1.0
chrismbeckett:toastr@2.1.2_1
crosswalk@1.3.1
ddp@1.2.2
ddp-client@1.2.1
ddp-common@1.2.2
ddp-rate-limiter@1.0.0
ddp-server@1.2.2
deps@1.0.9
diff-sequence@1.0.1
ecmascript@0.1.6
ecmascript-runtime@0.2.6
ejson@1.0.7
email@1.0.8
es5-shim@4.1.14
facebook@1.2.2
fortawesome:fontawesome@4.5.0
geojson-utils@1.0.4
google@1.1.7
harrison:papa-parse@1.1.1
hot-code-push@1.0.0
html-tools@1.0.5
htmljs@1.0.5
http@1.1.1
id-map@1.0.4
jquery@1.11.4
launch-screen@1.0.4
less@2.5.1
livedata@1.0.15
localstorage@1.0.5
logging@1.0.8
mdg:camera@1.4.0
mdg:geolocation@1.3.0
meteor@1.1.10
meteor-base@1.0.1
meteorhacks:async@1.0.0
meteorhacks:cluster@1.6.9
meteorhacks:npm@1.5.0
mikowals:batch-insert@1.1.13
minifiers@1.1.7
minimongo@1.0.10
mobile-status-bar@1.0.6
momentjs:moment@2.8.4
mongo@1.1.3
mongo-id@1.0.1
npm-bcrypt@0.7.8_2
npm-container@1.2.0
npm-mongo@1.4.39_1
oauth@1.1.6
oauth2@1.1.5
observe-sequence@1.0.7
ordered-dict@1.0.4
promise@0.5.1
random@1.0.5
rate-limit@1.0.0
reactive-dict@1.1.3
reactive-var@1.0.6
reload@1.1.4
retry@1.0.4
routepolicy@1.0.6
service-configuration@1.0.5
session@1.1.1
sha@1.0.4
spacebars@1.0.7
spacebars-compiler@1.0.7
srp@1.0.4
systemjs:systemjs@0.18.4
tanis:bootstrap-social@0.1.2
templating@1.1.5
templating-tools@1.0.0
tracker@1.0.9
tsega:bootstrap3-datetimepicker@4.17.37_1
twbs:bootstrap@3.3.6
ui@1.0.8
underscore@1.0.4
urigo:angular2-meteor@0.4.4
url@1.0.5
webapp@1.2.3
webapp-hashing@1.0.5
I removed the filesaver package and copied filesaver.js into my /client/lib/ directory. I had to make the following change to get it to work in my project:
changed line 15 from
var saveAs = saveAs || (function(view) {
to
saveAs = (function(view) {
So saveAs
could be recognized as a global function. To prevent typescript from complaining I added declare var saveAs:any
to the file I was trying to use the method in.
FileSaver.js goes in client/compatible not client/lib as per the pre Meteor (1.3) docs, it still works that way in the latest meteor 1.3 also. You should then not have to change a thing for it should be the same as having a script include in a web page.
Also did you read the docs on FileSaver.js ? The error you are getting is due to the "Blob" you are passing in being null. So it is probably and issue with how you are calling that.
Again I am just wrapping their library if the issue is not in the wrapper it should be posted on the FileSaver.js site as an issue and not here
If you can show that it is an issue with the wrapper then here is the correct place.
Thanks for the note on client/compatible, I'll give that a try. I really do think it is the package because my app will not compile immediately after adding it to my project, even before I write a single line of code to use it.
Copying filesaver.js unmodified into client/compatible does not work. Can you please direct me to where you found this information in the Meteor docs? I browsed through the docs quickly and could not determine which section pertained to this.
Here is the full terminal output as soon as I execute meteor add pfafman:filesaver
W20160413-09:25:07.904(-5)? (STDERR) W20160413-09:25:07.905(-5)? (STDERR) /Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245 W20160413-09:25:07.905(-5)? (STDERR) throw(ex); W20160413-09:25:07.905(-5)? (STDERR) ^ W20160413-09:25:07.910(-5)? (STDERR) TypeError: Cannot read property 'document' of undefined W20160413-09:25:07.911(-5)? (STDERR) at saveAs (packages/pfafman_filesaver/lib/FileSaver.js:22:1) W20160413-09:25:07.911(-5)? (STDERR) at Package (packages/pfafman_filesaver/lib/FileSaver.js:265:1) W20160413-09:25:07.911(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/Ionic2/WaiterDroid/app/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:302:4 W20160413-09:25:07.911(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/Ionic2/WaiterDroid/app/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:311:3 W20160413-09:25:07.911(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/Ionic2/WaiterDroid/app/.meteor/local/build/programs/server/boot.js:242:10 W20160413-09:25:07.911(-5)? (STDERR) at Array.forEach (native) W20160413-09:25:07.911(-5)? (STDERR) at Function._.each._.forEach (/Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11) W20160413-09:25:07.911(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/Ionic2/WaiterDroid/app/.meteor/local/build/programs/server/boot.js:137:5 => Exited with code: 8
You would need to get a hold of Pre 1.3 docs. I believe this is being depreciated but is still supported for legal in 1.3.
client/compatibility
This folder is for compatibility JavaScript libraries that rely on variables declared with var at the top level being exported as globals. Files in this directory are executed without being wrapped in a new variable scope. These files are executed before other client-side JavaScript files.
My suggestion would be to create a test repo in which you can duplicate the error without all the packages you have installed.
Steps to reproduce:
meteor create --release 1.2.1 test-filesaver-meteor1.2.1
Created a new Meteor app in 'test-filesaver-meteor1.2.1'.
To run your new app:
cd test-filesaver-meteor1.2.1
meteor
If you are new to Meteor, try some of the learning resources here:
https://www.meteor.com/learn
mjwheatley:~/Development/Tanoshii/MeteorWorkspace/exp$ cd test-filesaver-meteor1.2.1/
mjwheatley:~/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1$ meteor run
[[[[[ ~/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1
]]]]]
=> Started proxy.
=> Meteor 1.3.1 is available. Update this project with 'meteor update'.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
meteor add pfafman:filesaver
meteor run
[[[[[ ~/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1
]]]]]
=> Started proxy.
=> Meteor 1.3.1 is available. Update this project with 'meteor update'.
=> Started MongoDB.
W20160413-14:33:03.240(-5)? (STDERR)
W20160413-14:33:03.241(-5)? (STDERR) /Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20160413-14:33:03.241(-5)? (STDERR) throw(ex);
W20160413-14:33:03.241(-5)? (STDERR) ^
W20160413-14:33:03.241(-5)? (STDERR) TypeError: Cannot read property 'document' of undefined
W20160413-14:33:03.242(-5)? (STDERR) at saveAs (packages/pfafman_filesaver/lib/FileSaver.js:22:1)
W20160413-14:33:03.242(-5)? (STDERR) at Package (packages/pfafman_filesaver/lib/FileSaver.js:265:1)
W20160413-14:33:03.242(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:302:4
W20160413-14:33:03.242(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:311:3
W20160413-14:33:03.242(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/boot.js:242:10
W20160413-14:33:03.242(-5)? (STDERR) at Array.forEach (native)
W20160413-14:33:03.242(-5)? (STDERR) at Function._.each._.forEach (/Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20160413-14:33:03.242(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/boot.js:137:5
=> Exited with code: 8
W20160413-14:33:09.854(-5)? (STDERR)
W20160413-14:33:09.856(-5)? (STDERR) /Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20160413-14:33:09.856(-5)? (STDERR) throw(ex);
W20160413-14:33:09.856(-5)? (STDERR) ^
W20160413-14:33:09.861(-5)? (STDERR) TypeError: Cannot read property 'document' of undefined
W20160413-14:33:09.861(-5)? (STDERR) at saveAs (packages/pfafman_filesaver/lib/FileSaver.js:22:1)
W20160413-14:33:09.861(-5)? (STDERR) at Package (packages/pfafman_filesaver/lib/FileSaver.js:265:1)
W20160413-14:33:09.861(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:302:4
W20160413-14:33:09.861(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:311:3
W20160413-14:33:09.862(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/boot.js:242:10
W20160413-14:33:09.862(-5)? (STDERR) at Array.forEach (native)
W20160413-14:33:09.862(-5)? (STDERR) at Function._.each._.forEach (/Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20160413-14:33:09.862(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/boot.js:137:5
=> Exited with code: 8
W20160413-14:33:16.420(-5)? (STDERR)
W20160413-14:33:16.421(-5)? (STDERR) /Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20160413-14:33:16.422(-5)? (STDERR) throw(ex);
W20160413-14:33:16.426(-5)? (STDERR) ^
W20160413-14:33:16.427(-5)? (STDERR) TypeError: Cannot read property 'document' of undefined
W20160413-14:33:16.427(-5)? (STDERR) at saveAs (packages/pfafman_filesaver/lib/FileSaver.js:22:1)
W20160413-14:33:16.427(-5)? (STDERR) at Package (packages/pfafman_filesaver/lib/FileSaver.js:265:1)
W20160413-14:33:16.427(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:302:4
W20160413-14:33:16.427(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/packages/pfafman_filesaver.js:311:3
W20160413-14:33:16.427(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/boot.js:242:10
W20160413-14:33:16.427(-5)? (STDERR) at Array.forEach (native)
W20160413-14:33:16.427(-5)? (STDERR) at Function._.each._.forEach (/Users/mjwheatley/.meteor/packages/meteor-tool/.1.1.10.yln5cd++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20160413-14:33:16.428(-5)? (STDERR) at /Users/mjwheatley/Development/Tanoshii/MeteorWorkspace/exp/test-filesaver-meteor1.2.1/.meteor/local/build/programs/server/boot.js:137:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
Ok. I was able to get the same after I removed my local copy or this package. (i.e. $PACKAGE_DIRS).
I was able to fix it by just bumping the version number and republishing to atmosphere. Now when I do the above with either 1.2.1 or 1.3 things run and I can see the saveAs function in the console.
Please test it again.
Running meteor update pfafman:filesaver
updated the package to v0.2.3_2 and resolved this issue.
A big "Thank You!" to @pfafman for your time and attention to help resolve this issue.
at saveAs (packages/pfafman_filesaver/lib/FileSaver.js:22:1)
doc = view.document