As Github source code Metabase developers use Linux or MAC as the development environment, so there are unfriendly Windows environment, some even pit. Even many Metabase Windows developers use Linux virtual machines to run their environments.

Of course, if you run Linux on a virtual machine, or use Ubuntu for Windows development, some problems do not exist, there is a good way to use git bash environment to build, see: Metabase-bi series 03: Win system with Git-bash start Metabase.

Git-clone source code LF problem

Trigger LF and trigger LF are available in Git

git config --global core.autocrlf true// Commit to LF and check out to CRLF git config --global corefalseChange git config (for example, step 1) and trigger trigger (for example, step 2). Change git config (for example, step 2) and trigger trigger (for example, step 2trueGit config --global core.safecrlffalseGit config --global core.safecrlf warn git config --global core.safecrlf warn git config --global core.safecrlf warnCopy the code

If: AutoCRLF is set to true, the code converts CRLF, code background can run up, the front desk web side access blank, js errors, all kinds of property is undefined

The second step is to change the level of the trigger (for example, the second step) by setting the trigger for change (autocrat lf) to false and then triggering git clone

To be sure, there are bugs in the conversion from LF to CRLF itself, so it is easy to cause problems

Pit 2: Grep command error during yarn install

During install, you need to remove the grep command, which is a Linux command, showing that you have not considered the feelings of Windows environment at all. Of course, you can also try to install grep programs executed under Windows

"preinstall": "echo $npm_execpath | grep -q yarn || echo '\\033[0;33mSorry, npm is not supported. Please use Yarn (https://yarnpkg.com/).\\033[0m'".Copy the code

Pit 3: NODE_ENV is not an internal or external command

When installing, NODE_ENV is not an internal or external command, which is a Linux/Windows issue

Linux: NODE_ENV = hot Windows:set NODE_ENV=hot
Copy the code

In Windows, you can add a set variable directly, or remove it, first set variable, and then install.

Note: this is the hot deployment variable, if hot deployment is required, this command should not be less.

Pit 4: Lein Ring Server file name extension error

Compilation failed: Cannot run program "java" (in directory "D:\metabase"): CreateProcess Error =206, filename or extension too long. Error encountered performing task'ring' with profile(s): 'base,system,user,provided,dev,ring'
Compilation failed: Cannot run program "java" (in directory "D:\metabase"): CreateProcess Error =206, filename or extension too long.Copy the code

This problem is caused by Windows system, if it is Win10 may be able to lift the length limit, if it is Win7 or earlier Windows version estimate is not good to solve, can not use hot deployment, but Lein Run is possible

Pothole 5: Auto-create dashboard (PivotTable) issue

After login home page, always send request, HTML 500 error

Request URL:  http://localhost:3000/api/automagic-dashboards/database/2/candidates
Request Method: GET
Status Code:  500 Server Error 
Copy the code

Background error, unable to find directory file

Is obviously a Windows path error, can special treatment, find the SRC/metabase/util/files. CLJ

(defn do-with-open-path-to-resource
 "Impl for `with-open-path-to-resource`."
 [^String resource, f]
 (let [url (io/resource resource)]
  (when-not url
   (throw (FileNotFoundException. (trs "Resource does not exist."))))
  (if (url-inside-jar? url)
   (with-open [fs (jar-file-system-from-url url)]
​    (f (get-path-in-filesystem fs "/"resource))) ; Windows Repair PivotTable path subs Remove the prefix (f (get-path (subs (.getPath URL) 1))))))Copy the code

Pit 6: Data sources and Chinese packages do not generate automatically

In normal cases, the database driver package is generated under the installation directory /plugins. If no new database is added, only the default database types can be selected

In normal cases, the installation directory /resources/frontend_client/app/locales generates json in multiple languages

In Windows, some shell script commands cannot run normally, so they cannot be generated normally. You can directly download and put them under the corresponding directory. The database driver package can also be directly generated by lein UberJAR under each driver directory of module.

Problem 7: Metabase jar packages conflict

Metabase has a lot of branches, some are version branches, if using a new boss, do not cross use different versions, Metabase will detect and clean up normally when running, once there is a check and do not clear the update will appear JAR package conflict.

Blog links: dumplingbao. Making. IO / 2019/11/06 /…