We strongly recommend running Linux either on a USB, dual boot, emulator, or as your primary OS. Running local dev environment on Windows has been managed a few times, but it is extremely temperamental and time consuming to set up and maintain as new errors tend to pop up almost daily.
Setting Up The Development Environment
- install meteor
Install Meteor.js | Meteor API Docs
-
create a fork of this repository and then
`git clone https://github.com/your-github-username/fl-maps >>> git clone -b master --single-branch https://github.com/your-github-username/fl-maps’
-
Set up git
git remote add upstream https://github.com/focallocal/fl-maps
// make sure there are 2 remotes (origin that points to your fork and upstream for the original repo) git remote -v
-
every time you start working on a new feature, run:
git pull upstream master
which ensures you are always working with the most updated version of the project. -
create a new branch
git checkout -b new-feature-name
-
To get the most recent settings.json file Request Access here. Message @AndyatFocallocal, @tmcnulty, @ArtyS, or another active member if it’s not approved in a few hours and you want to get coding.
After you obtain the most recent settings.json file and place it in the project’s folder
- settings.json has a property named 'mapType': 'gatherings'
,
you can change ‘gatherings’ to ‘btm’ to work on Focallocal or Brighter Tomorrow
(If the settings.json file doesn’t work (i.e, you can’t start the project by running npm run start), tag the @ReactMeteor team and the 1st person to see you message will offer support)
-
run the project
meteor npm install npm run start // see notes below if it fails to run
-
make changes
-
run tests (
npm test
ornpm run test-watch
) -
if all the tests have passed, run
git add . git commit -m 'description of what has changed' git push origin your_working_branch_name
-
go to github and create a new pull request from your fork (make sure it’s against the fl-maps/master branch)
(make sure it’s against the fl-maps/master branch) >>> (make sure it’s against the fl-maps/master branch)
If it Errors
** !if you encounter any errors related to sass-loader, run the following command! **
meteor npm rebuild node-sass --force
Currently you’ll see a Compiled with warnings. message, ignore it.
Step (5) Warnings
For step (5) be sure you don’t run meteor npm install
twice. Just do it once followed by npm run start
and it will work.
Detailed Explanation
If run twice you may get several warnings such as these:npm WARN bootstrap@4.1.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps@9.4.5 requires a peer of @types/googlemaps@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps@9.4.5 requires a peer of @types/markerclustererplus@^2.1.29 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps@9.4.5 requires a peer of @types/react@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN uniforms@1.24.3 requires a peer of graphql@>=0.8.2 <1.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
If you try to install them by:
meteor npm install jquery @types/googlemaps@^3.0.0 @types/markerclustererplus@^2.1.29 @types/react@^16.0.0 graphql@0.13.2
… then during the npm run start
step, compile will fail with errors such as these:
ERROR in ./imports/both/i18n/en/categories.json
Module parse failed: Unexpected token < in JSON at position 149
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token < in JSON at position 149
...
ERROR in chunk main [entry]
...
W20190111-19:03:18.261(8)? (STDERR) ERROR in /home/sum/sum/job/remoteok/focallocal/fl-maps/node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphql' from non EcmaScript module (only default export is available)
...
W20190111-19:03:18.272(8)? (STDERR) 2:0-49 Can't reexport the named export 'graphqlSync' from non EcmaScript module (only default export is available)
...
W20190111-19:03:18.292(8)? (STDERR) 39:0-61:50 Can't reexport the named export 'DEFAULT_DEPRECATION_REASON' from non EcmaScript module (only default export is available)
...
W20190111-19:03:18.300(8)? (STDERR) 39:0-61:50 Can't reexport the named export 'GraphQLBoolean' from non EcmaScript module (only default export is available)
Updating Node & npm
If you’ve tried the above, and things still aren’t working you may need to update your version of node & npm. First, check your version of node by running node -v
, and take note of it. The current version of node as of writing this is 11.9.0.
To update node, install the package n
, by running the command: npm install -g n
. After the installation, run n latest
. note: you may need to run sudo n latest
, if on Mac or Linux.
Updating npm is quite simple, the command being: npm install -g npm
.
After updating the packages, close your current terminal and open a new one, so that the changes may take effect. Confirm the update by typing node -v
.
Setting Up Discourse on Localhost
Our ReactJS and MeteorJS platform loads inside an i-frame inside Discourse and opensource forum and community building software, plugging their community building tools and god-tier admin section into our build. Here’s the thread for setting up Discourse on Localhost which will be needed for many tasks.
Navigating Localhost
The searchbar at the top on localhost is different from the one on the live website which comes from Discourse, so the navigation links there won’t get you where you want to go (although there are some fun easter eggs there).
You can find the map here:
- /map:
which on the Meta site goes to here: https://fl-maps.publichappinessmovement.com/map
All the pages and their relation on the map/reactjs side are listed here: https://github.com/focallocal/fl-maps/blob/master/public/dcs-website.json
Common Bugs
Please create a new post somewhere in the Web Dev Category for all bugs you encounter, even if you successfully solve it yourself
When solved @ tag Andy at Focallocal and i’ll add it here to help everyone who joins in the future.