w0rm / gulp-svgstore

Combine svg files into one with symbol elements
https://www.npmjs.com/package/gulp-svgstore
646 stars 33 forks source link

TypeError: Cannot call method 'value' of null #6

Closed bigandy closed 10 years ago

bigandy commented 10 years ago

Getting this, and cannot run gulp now:

/Applications/XAMPP/xamppfiles/htdocs/proj/wp-content/themes/proj/node_modules/gulp-svgstore/index.js:34 var viewBoxAttr = xmlDoc.root().attr('viewBox').value() ^ TypeError: Cannot call method 'value' of null at Transform.transform [as _transform] (/Applications/XAMPP/xamppfiles/htdocs/proj/wp-content/themes/proj/node_modules/gulp-svgstore/index.js:34:55) at Transform._read (/Applications/XAMPP/xamppfiles/htdocs/proj/wp-content/themes/proj/node_modules/gulp-svgstore/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10) at Transform._write (/Applications/XAMPP/xamppfiles/htdocs/proj/wp-content/themes/proj/node_modules/gulp-svgstore/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12) at doWrite (/Applications/XAMPP/xamppfiles/htdocs/proj/wp-content/themes/proj/node_modules/gulp-svgstore/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:238:10) at writeOrBuffer (/Applications/XAMPP/xamppfiles/htdocs/proj/wp-content/themes/proj/node_modules/gulp-svgstore/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:228:5) at Transform.Writable.write (/Applications/XAMPP/xamppfiles/htdocs/proj/wp-content/themes/proj/node_modules/gulp-svgstore/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:195:11) at write (_stream_readable.js:601:24) at flow (_stream_readable.js:610:7) at Transform.pipeOnReadable (_stream_readable.js:642:5) at Transform.emit (events.js:92:17)

bigandy commented 10 years ago

Also, I got this error stream when I installed it :

`$ npm install \

libxmljs@0.9.0 install /Applications/XAMPP/xamppfiles/htdocs/teleflex/wp-content/themes/teleflex/node_modules/gulp-svgstore/node_modules/libxmljs node-gyp rebuild

CC(target) Release/obj.target/libxml/vendor/libxml/buf.o CC(target) Release/obj.target/libxml/vendor/libxml/catalog.o CC(target) Release/obj.target/libxml/vendor/libxml/chvalid.o CC(target) Release/obj.target/libxml/vendor/libxml/dict.o CC(target) Release/obj.target/libxml/vendor/libxml/encoding.o CC(target) Release/obj.target/libxml/vendor/libxml/entities.o CC(target) Release/obj.target/libxml/vendor/libxml/error.o CC(target) Release/obj.target/libxml/vendor/libxml/globals.o CC(target) Release/obj.target/libxml/vendor/libxml/hash.o CC(target) Release/obj.target/libxml/vendor/libxml/HTMLparser.o CC(target) Release/obj.target/libxml/vendor/libxml/HTMLtree.o CC(target) Release/obj.target/libxml/vendor/libxml/legacy.o CC(target) Release/obj.target/libxml/vendor/libxml/list.o CC(target) Release/obj.target/libxml/vendor/libxml/parser.o ../vendor/libxml/parser.c:13492:43: warning: passing 'const xmlChar ' (aka 'const unsigned char ') to parameter of type 'const char ' converts between pointers to integer types with different sign [-Wpointer-sign] hdlr = xmlFindCharEncodingHandler(doc->encoding); ^~~~~ ../vendor/libxml/include/libxml/encoding.h:175:42: note: passing argument to parameter 'name' here xmlFindCharEncodingHandler (const char name); ^ 1 warning generated. CC(target) Release/obj.target/libxml/vendor/libxml/parserInternals.o CC(target) Release/obj.target/libxml/vendor/libxml/pattern.o CC(target) Release/obj.target/libxml/vendor/libxml/relaxng.o CC(target) Release/obj.target/libxml/vendor/libxml/SAX2.o CC(target) Release/obj.target/libxml/vendor/libxml/SAX.o CC(target) Release/obj.target/libxml/vendor/libxml/tree.o CC(target) Release/obj.target/libxml/vendor/libxml/threads.o CC(target) Release/obj.target/libxml/vendor/libxml/uri.o CC(target) Release/obj.target/libxml/vendor/libxml/valid.o CC(target) Release/obj.target/libxml/vendor/libxml/xinclude.o CC(target) Release/obj.target/libxml/vendor/libxml/xlink.o CC(target) Release/obj.target/libxml/vendor/libxml/xmlIO.o CC(target) Release/obj.target/libxml/vendor/libxml/xmlmemory.o CC(target) Release/obj.target/libxml/vendor/libxml/xmlmodule.o CC(target) Release/obj.target/libxml/vendor/libxml/xmlreader.o CC(target) Release/obj.target/libxml/vendor/libxml/xmlregexp.o CC(target) Release/obj.target/libxml/vendor/libxml/xmlsave.o CC(target) Release/obj.target/libxml/vendor/libxml/xmlschemas.o ../vendor/libxml/xmlschemas.c:24203:10: warning: explicitly assigning a variable of type 'xmlSchemaValType' to itself [-Wself-assign] valType = valType;


1 warning generated.
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlschemastypes.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlstring.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlunicode.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlwriter.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xpath.o
../vendor/libxml/xpath.c:12402:13: warning: comparison of constant 'XML_NAMESPACE_DECL' (18) with expression of type 'xmlXPathTypeVal' is always false
      [-Wtautological-constant-out-of-range-compare]
                        if (type == XML_NAMESPACE_DECL)
                            ~~~~ ^  ~~~~~~~~~~~~~~~~~~
In file included from ../vendor/libxml/xpath.c:185:
../vendor/libxml/trionan.c:194:1: warning: unused function 'trio_is_special_quantity' [-Wunused-function]
trio_is_special_quantity
^
../vendor/libxml/trionan.c:218:1: warning: unused function 'trio_is_negative' [-Wunused-function]
trio_is_negative
^
3 warnings generated.
  CC(target) Release/obj.target/libxml/vendor/libxml/xpointer.o
  LIBTOOL-STATIC Release/xml.a
  CXX(target) Release/obj.target/xmljs/src/libxmljs.o
  CXX(target) Release/obj.target/xmljs/src/xml_attribute.o
  CXX(target) Release/obj.target/xmljs/src/xml_document.o
  CXX(target) Release/obj.target/xmljs/src/xml_element.o
  CXX(target) Release/obj.target/xmljs/src/xml_namespace.o
  CXX(target) Release/obj.target/xmljs/src/xml_node.o
  CXX(target) Release/obj.target/xmljs/src/xml_sax_parser.o
  CXX(target) Release/obj.target/xmljs/src/xml_syntax_error.o
  CXX(target) Release/obj.target/xmljs/src/xml_xpath_context.o
  SOLINK_MODULE(target) Release/xmljs.node
  SOLINK_MODULE(target) Release/xmljs.node: Finished
gulp-svgstore@1.0.0 node_modules/gulp-svgstore
├── through2@0.4.2 (readable-stream@1.0.27-1, xtend@2.1.2)
├── gulp-util@3.0.0 (lodash._reinterpolate@2.4.1, dateformat@1.0.8-1.2.3, minimist@0.2.0, through2@0.5.1, vinyl@0.2.3, chalk@0.5.1, multipipe@0.1.1, lodash.template@2.4.1)
└── libxmljs@0.9.0 (bindings@1.0.0)`
w0rm commented 10 years ago

Seems like your svg is missing viewBox attr, I'll add a check for this

w0rm commented 10 years ago

@bigandy try to update package and run again

w0rm commented 10 years ago

@bigandy your second problem is not related to gulp-svgstore, these warnings belong to libxmljs.

bigandy commented 10 years ago

Great! Thanks this works again!