Trying to use read-exif in a super simple spike solution following the readme in read-exif.
The application throws with the message 'Cannot read property 'Types' of undefined' in
'.../node_modules/get-exif/index.js:6:102' in get-exif.
@gabrielchase hit the same error in read-exif project issue #1 (Error when importing #1).
Tracing down the error I found out that index.js in get-exif requires the following line:
Hacking the code and removing the level "constants" in the require('piexifjs') solved the problem.
What remained is the fact that Tags is missing in the piexifjs export.
I only didn't find out, why the test.js is running fine although the index.js of the get-exif project uses the same require.
Did I misuse the program ('get-exif') or do we have an error in the project?
If it helps I can easily create a pull request for that.
--------------------- here my test program ----------------------------------
'use strict';
const getExif = require('get-exif');
console.log('require "get-exif" runs');
Trying to use read-exif in a super simple spike solution following the readme in read-exif.
The application throws with the message 'Cannot read property 'Types' of undefined' in '.../node_modules/get-exif/index.js:6:102' in get-exif. @gabrielchase hit the same error in read-exif project issue #1 (Error when importing #1).
Tracing down the error I found out that index.js in get-exif requires the following line:
const {constants: {Types: {Ascii, Rational, SRational}}, load, Tags: {Exif}, TagValues: {ExifIFD}} = require('piexifjs');
but piexifjs (version 2.0.0-beta.7 as used in get-exif version 1.0.3) returns an object with the following structure:
{version, Types, TagValues, GPSHelper, ValueConvertError, remove, insert, load, dump
.Hacking the code and removing the level "constants" in the
require('piexifjs')
solved the problem.What remained is the fact that
Tags
is missing in the piexifjs export.I only didn't find out, why the test.js is running fine although the index.js of the get-exif project uses the same require.
Did I misuse the program ('get-exif') or do we have an error in the project? If it helps I can easily create a pull request for that.
--------------------- here my test program ---------------------------------- 'use strict'; const getExif = require('get-exif'); console.log('require "get-exif" runs');