<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ricky Eckhardt</title>
    <description>The latest articles on DEV Community by Ricky Eckhardt (@rickyeckhardt).</description>
    <link>https://dev.to/rickyeckhardt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F171196%2F7cfc2a79-f744-4d70-92bf-0dcadd820a19.jpg</url>
      <title>DEV Community: Ricky Eckhardt</title>
      <link>https://dev.to/rickyeckhardt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rickyeckhardt"/>
    <language>en</language>
    <item>
      <title>Get up and Running with Meteor in WSL2</title>
      <dc:creator>Ricky Eckhardt</dc:creator>
      <pubDate>Sat, 08 Aug 2020 17:56:18 +0000</pubDate>
      <link>https://dev.to/rickyeckhardt/get-up-and-running-with-meteor-in-wsl2-4cjc</link>
      <guid>https://dev.to/rickyeckhardt/get-up-and-running-with-meteor-in-wsl2-4cjc</guid>
      <description>&lt;p&gt;Getting started with Meteor on Windows Subsystem Linux 2 (WSL2) is easy, but it requires a few departures from the Meteor Developers documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1:
&lt;/h3&gt;

&lt;p&gt;On WSL2? Install the latest official Meteor release from your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl https://install.meteor.com/ | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: You may need to use the sudo command to install Meteor. If you do a prompt will pop up for you to enter your WSL2 root password.&lt;/p&gt;

&lt;p&gt;If installed correctly you should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ricky@DESKTOP-ULOB7UG:~$ curl https://install.meteor.com/ | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7915    0  7915    0     0  40589      0 --:--:-- --:--:-- --:--:-- 40589
Removing your existing Meteor installation.
Downloading Meteor distribution
######################################################################## 100.0%

Meteor 1.10.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
[sudo] password for ricky: 

To get started fast:

  $ meteor create ~/my_cool_app
  $ cd ~/my_cool_app
  $ meteor

Or see the docs at:

  docs.meteor.com

Deploy and host your app with Galaxy:

  www.meteor.com/hosting
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2:
&lt;/h3&gt;

&lt;p&gt;Now that the installation is complete we need to change an environment variable to prevent issues when running MondoDB. &lt;/p&gt;

&lt;p&gt;To continue we need to vi and edit a file at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/packaging/catalog/catalog-remote.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: This file path will change depending on the version installed.&lt;/p&gt;

&lt;p&gt;To do this run the following command after changing the path to match your home directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vi /home/ricky/.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/packaging/catalog/catalog-remote.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If vi tells you [Permission Denied] simply back out of vi using :q and run the following command after changing it to match your home directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo vi /home/ricky/.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/packaging/catalog/catalog-remote.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have the file open we need to change the following code around line 31:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const JOURNAL_MODE = process.env.METEOR_SQLITE_JOURNAL_MODE || "WAL";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To read:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const JOURNAL_MODE =
  process.env.METEOR_SQLITE_JOURNAL_MODE || "TRUNCATE";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To do this using vi simply arrow up or down to the line and type :R to edit the line, once finished, hit ESC. Now exit vi using :wq to save and exit.&lt;/p&gt;

&lt;p&gt;If you had to run sudo to edit the file you need to modify it's permissions. &lt;/p&gt;

&lt;p&gt;To do this run the following command changing it's home directory to match yours:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +rw  /home/ricky/.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/packaging/catalog/catalog-remote.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3:
&lt;/h3&gt;

&lt;p&gt;You are ready to create your Meteor app! &lt;/p&gt;

&lt;p&gt;To create a Meteor app run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;meteor create ~/myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates a meteor app in the home directory of WSL2. Creating the application in the home directory avoids errors listed in the error section of this guide. &lt;/p&gt;

&lt;p&gt;If your app was created successfully you should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ricky@DESKTOP-ULOB7UG:~$ meteor create ~/myapp
Created a new Meteor app in '/home/ricky/myapp'.

To run your new app:                          
  cd /home/ricky/myapp                        
  meteor                                      

If you are new to Meteor, try some of the learning resources here:
  https://www.meteor.com/tutorials            

When you’re ready to deploy and host your new Meteor application, check out Galaxy:
  https://www.meteor.com/hosting              

To start with a different app template, try one of the following:

  meteor create --bare       # to create an empty app
  meteor create --minimal    # to create an app with as few Meteor packages as possible
  meteor create --full       # to create a more complete scaffolded app
  meteor create --react      # to create a basic React-based app
  meteor create --typescript # to create an app using TypeScript and React
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you are ready to go with Meteor!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4:
&lt;/h3&gt;

&lt;p&gt;Let's finish up by ensuring everything is running correctly!&lt;/p&gt;

&lt;p&gt;First let's start the Meteor server.&lt;/p&gt;

&lt;p&gt;To start the server simply type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd myapp
meteor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If started correctly you should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[[[[[ ~/myapp ]]]]]                           

=&amp;gt; Started proxy.                             
=&amp;gt; Started MongoDB.                           
=&amp;gt; Started your app.                          

=&amp;gt; App running at: http://localhost:3000/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alright, there is one more thing to check. We need to ensure that Meteor Mongo will start. &lt;/p&gt;

&lt;p&gt;To do this open a second WSL2 window and run the following command in the directory you just created your app in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;meteor mongo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything worked above you should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MongoDB shell version v4.2.5
connecting to: mongodb://127.0.0.1:3001/meteor?compressors=disabled&amp;amp;gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("0a0211ad-c3d5-478f-8427-7f90d2f54cd4") }
MongoDB server version: 4.2.5
meteor:PRIMARY&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations you are up and running with Meteor in WSL2! If you've run into an error check below to see the cause. &lt;/p&gt;

&lt;h2&gt;
  
  
  Errors you may run into using WSL2:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Error From Creating an App in a Windows Directory
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Error
&lt;/h4&gt;

&lt;p&gt;User gets the following message after creating a Meteor project on a mounted Windows drive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ricky@DESKTOP-ULOB7UG:/mnt/c/Meteor/todo$ meteor
[[[[[ /mnt/c/code/Meteor/todo ]]]]]           

=&amp;gt; Started proxy.                             
Unexpected mongo exit code null. Restarting.  
Unexpected mongo exit code null. Restarting.  
Unexpected mongo exit code null. Restarting.  
Can't start Mongo server.                     
ricky@DESKTOP-ULOB7UG:/mnt/c/Meteor/todo$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Fix
&lt;/h4&gt;

&lt;p&gt;A quick fix to this is to create your project within your home directory in WSL2. &lt;/p&gt;

&lt;p&gt;In WSL2 run the following command to create a project in your home directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;meteor create ~/todo 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Error from not changing from WAL to Truncate
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Error
&lt;/h4&gt;

&lt;p&gt;Running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;meteor mongo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The user gets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: SQLITE_PROTOCOL: locking protocol
Retrying after error Error: SQLITE_PROTOCOL: locking protocol
=&amp;gt; awaited here:
at Promise.await
(/home/ricky/.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:60:12)
at Db._execute (/tools/packaging/catalog/catalog-remote.js:361:8)
at /tools/packaging/catalog/catalog-remote.js:150:10
at Db._retry (/tools/packaging/catalog/catalog-remote.js:162:16)
at new Db (/tools/packaging/catalog/catalog-remote.js:149:8)
at RemoteCatalog.initialize (/tools/packaging/catalog/catalog-remote.js:699:15)
at /tools/cli/main.js:875:20 {
errno: 15,
code: 'SQLITE_PROTOCOL'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Fix
&lt;/h4&gt;

&lt;p&gt;To correct this error edit the &lt;a href="https://github.com/meteor/meteor/blob/master/tools/packaging/catalog/catalog-remote.js"&gt;meteor/tools/packaging/catalog/catalog-remote.js&lt;/a&gt; using the steps above. &lt;/p&gt;

&lt;h3&gt;
  
  
  Notes:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://guide.meteor.com/#quickstart"&gt;Meteor Documentation&lt;/a&gt; &lt;br&gt;
&lt;a href="https://chrisfleischhacker.wordpress.com/2019/10/17/notes-on-moving-meteor-development-to-wsl-debian/"&gt;Notes on Moving Meteor Development to WSL Debian&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/meteor/meteor-feature-requests/issues/154"&gt;Support "Bash on Windows" #154&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/meteor/meteor/pull/9644"&gt;TRUNCATE journal mode for packaging DB on Windows like file systems #9644&lt;/a&gt;&lt;/p&gt;

</description>
      <category>meteor</category>
      <category>wsl2</category>
      <category>node</category>
      <category>mongodb</category>
    </item>
  </channel>
</rss>
