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

Can't build react-leaflet locally #375

Closed
thisissami opened this issue Sep 5, 2017 · 5 comments
Closed

Can't build react-leaflet locally #375

thisissami opened this issue Sep 5, 2017 · 5 comments

Comments

@thisissami
Copy link

Hi. I'm trying to integrate a slightly modified version of react-leaflet into an app I'm building, but ran into a hitch when I was unable build from source. I cloned this repository and tried to build that, but I get the same error - so it is not due to my modifications.

Expected behavior

After cloning this repository and running npm install, I expect npm run build to generate usable files in /dist.

Actual behavior

npm run build works up until the build:umd bit. The specific error I get is:

> react-leaflet@1.6.6 build:umd /Users/thisissami/code/contracts/SteveWilliams/react-leaflet
> cross-env BABEL_ENV=rollup NODE_ENV=development rollup -c

[!] SyntaxError: Unexpected token )
/Users/thisissami/code/contracts/SteveWilliams/react-leaflet/rollup.config.js:49
  );
  ^

SyntaxError: Unexpected token )
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.require.extensions..js (/Users/thisissami/code/contracts/SteveWilliams/react-leaflet/node_modules/rollup/bin/rollup:2667:8)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at rollup.rollup.then.then (/Users/thisissami/code/contracts/SteveWilliams/react-leaflet/node_modules/rollup/bin/rollup:2674:20)


npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/thisissami/.nvm/versions/node/v6.11.2/bin/node" "/Users/thisissami/.nvm/versions/node/v6.11.2/bin/npm" "run" "build:umd"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! react-leaflet@1.6.6 build:umd: `cross-env BABEL_ENV=rollup NODE_ENV=development rollup -c`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react-leaflet@1.6.6 build:umd script 'cross-env BABEL_ENV=rollup NODE_ENV=development rollup -c'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the react-leaflet package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env BABEL_ENV=rollup NODE_ENV=development rollup -c
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs react-leaflet
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls react-leaflet
npm ERR! There is likely additional logging output above.

Steps to reproduce

  1. git clone https://github.com/PaulLeCam/react-leaflet.git to get a clean copy of this directory.
  2. npm install to install all the dependencies.
  3. npm run build <-- error happens here

Perhaps you could just jump to npm run build:umd without having the rest of the scripts in npm run build run... I don't know enough about what everything is doing though to know whether that is indeed the case.

I've attached the npm-debug.log to this post in case that's useful (as a zip file cuz github won't let me upload it as a logfile).
npm-debug.log.zip

@thisissami
Copy link
Author

@tusbar tagging you here since (looking through this repos history) it looks like you switched the build to use rollup, and accordingly I'm betting you might have some idea around what's going on.

@PaulLeCam
Copy link
Owner

Could be your version of node, please use node 8

@tusbar
Copy link
Contributor

tusbar commented Sep 6, 2017

Yeah, the syntax error is definitely due to the node version. Though it is fixable: #376.

@tusbar
Copy link
Contributor

tusbar commented Sep 6, 2017

Random thought: what could be nice is to have the UMD bundles be available as release downloads (automatically added by the CI), so we don’t have to let the users build their own UMD builds (and we can get rid of node 6 ;))

I’ve done something like that in the past: https://github.com/armateam/extension/releases, generated by https://github.com/armateam/extension/blob/master/circle.yml#L40-L42.

@thisissami
Copy link
Author

Hey! Whoops I feel silly. The output I got did warn me that I should use the latest version of Node, and somehow in my mind I thought that they latest of v6 would do. Whoops!

@tusbar I implemented the changes from #376 and that 100% worked for me. :) Didn't need to upgrade my version of node! :) 👍 to having that integrated in the codebase - super easy change to open up builds for a larger userbase! (though of course just upgrading to v8 is super easy too, especially with nvm). Thanks for the quick responses guys!

PaulLeCam pushed a commit that referenced this issue Sep 6, 2017
* Remove comma that causes a syntax error in node 6

Fix #375

* Add node 6 back to travis
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

3 participants