Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'babel-runtime/helpers/possibleConstructorReturn' #74

Open
pilarArr opened this issue Nov 28, 2018 · 8 comments

Comments

@pilarArr
Copy link

pilarArr commented Nov 28, 2018

I'm using geotiff on a meteor app. I get this error when deploying but not when running on development mode.

The geotiff version I'm using is 1.0.0-beta.6
I'm not using babel-runtime because meteor updated to babel 7 some time ago. So I'm using @babel/runtime 7.1.5. Should I install babel-runtime as well ?

Error: Cannot find module 'babel-runtime/helpers/possibleConstructorReturn'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/built_app/programs/server/npm/node_modules/geotiff/dist/geotiff.js:8:35)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/built_app/programs/server/npm/node_modules/geotiff/dist/main.js:7:16)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at npmRequire (/built_app/programs/server/npm-require.js:133:10)
    at Module.useNode (packages/modules-runtime.js:664:18)
@constantinius
Copy link
Member

Hi @pilarArr

Thanks for reporting this issue. I guess you have two options: you can either use the older babel-runtime or use the source files directly: import GeoTIFF from 'geotiff/src/main';

@pilarArr pilarArr changed the title Error Error: Cannot find module 'babel-runtime/helpers/possibleConstructorReturn' Nov 28, 2018
@pilarArr
Copy link
Author

pilarArr commented Nov 28, 2018

Hi @constantinius ! Thanks for your fast reply.
I've tried importing directly from source files and I get this error:

project/folder/node_modules/geotiff/src/main.js:1
(function (exports, require, module, __filename, __dirname) { export * from './geotiff';
SyntaxError: Unexpected token export
     at createScript (vm.js:80:10)
     at Object.runInThisContext (vm.js:139:10)
     at Module._compile (module.js:616:28)

When installing the older babel-runtime it works, but I'm going to keep trying with importing from source. I would rather not install the older babel-runtime if I can, because I would need to have both installed since meteor uses babel 7

@constantinius
Copy link
Member

Ah, okay, so this does not work without transpiling. We currently use a webpack based approach using babel-loader. I guess the whole toolchain is based on an older version of babel.
This babel setup is already a source of pain, I guess it needs some attention.

@pilarArr
Copy link
Author

@constantinius I'll be finally using the older babel-runtime. I can close the issue if you want.

@constantinius
Copy link
Member

@pilarArr Alright, good to know. I think we can leave this open, I'll comb through the issues when I revise the babel setup.

@wshaver
Copy link

wshaver commented Mar 10, 2019

Had a similar issue with a fresh install for a node based project. Needed to install the dev dependencies in the /node_modules/geotiff directory.

@bmulcahy
Copy link

@wshaver Care to share your setup?

I am just using npm install and then import GeoTIFF from 'geotiff' and I received this

×
TypeError: Cannot read property 'fromUrl' of undefined
Map.componentDidMount
D:/Projects/openlayers-react-simple/src/components/map.js:18
  15 | class Map extends React.Component {
  16 |   componentDidMount() {
  17 | 
> 18 |     GeoTIFF.fromUrl(geotiffURL)
  19 |     .then(tiff => { 
  20 |       const image = tiff.getImage();
  21 |       const width = image.getWidth();

then I tried import { GeoTIFF } from 'geotiff/dist/geotiff'
and received this

×
TypeError: geotiff_dist_geotiff__WEBPACK_IMPORTED_MODULE_14__.GeoTIFF.fromUrl is not a function

then I tried import { GeoTIFF } from 'geotiff/src/main'

and received this

Failed to compile
./node_modules/geotiff/src/pool.js
Attempted import error: './decoder.worker' does not contain a default export (imported as 'Worker').

@bmulcahy
Copy link

Ok So I did get it working with

import * as GeoTIFF from 'geotiff/src/main';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants