码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • ubuntu 16.04成功安装meteor


    一。 初装篇

    反复装了十多遍,每次都是返回:

    Unexpected mongo exit code null. Restarting...

    Can't start Mongodb.

    从一开始以为是已经安装了mongo或者其他软件,导致冲突,到后来干脆使用干净的os,可是始终都是这个报错。国内国外看了一堆解决问题的帖子,全都尝试了一遍,还是不行。

    所以最后猜得原因就是meteor版本跟os不匹配。

    安装了meteor最新版,npm,node都安装了最新版,还是报这个错。

    后来把meteor版本回到2.0,其他什么都没做,......,终于看到meteor成功启动了,哈哈哈

    test@ubuntu:/test/mymeteor/test1$ meteor
    [[[[[ /test/mymeteor/test1 ]]]]]              

    => Started proxy.                             
    => Started HMR server.                        
    => Started MongoDB.                           
    => Started your app.                          

    => App running at: http://localhost:3000/
     

    以下为完整步骤:

    1。下载, curl https://install.meteor.com > meteor.sh,

    修改 “RELEASE="2.7.3" ”为 “RELEASE="2.0"”

    2。下载安装包

    https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/2.0/meteor-bootstrap-os.linux.x86_64.tar.gz

    3。安装,注意安装用户不要用root,目录权限全改为当前用户

    ./meteor.sh

    4. 创建meteor项目

    meteor create test1

    cd test1
    meteor 

    5。成功

    二。使用篇:

    在meteor默认工程上,加入自己的数据和页面展示

    1。title在clients/main.html中修改

    2。 数据在server\main.js中添加:

    import { StuCollection } from '/imports/api/links';

    function insertStu({ name, age }) {
      StuCollection.insert({name, age, createdAt: new Date()});
    }

     

    Meteor.startup(() => {
      // If the Links collection is empty, add some data.
      if (LinksCollection.find().count() === 0) {
        insertLink({
          title: 'Do the Tutorial',
          url: 'https://www.meteor.com/tutorials/react/creating-an-app'
        });

        insertLink({
          title: 'Follow the Guide',
          url: 'http://guide.meteor.com'
        });

        insertLink({
          title: 'Read the Docs',
          url: 'https://docs.meteor.com'
        });

        insertLink({
          title: 'Discussions',
          url: 'https://forums.meteor.com'
        });
      }
      
        if (StuCollection.find().count() === 0) {
        insertStu({
          name: 'aaa',
          age: '16'
        });
        
        insertStu({
          name: 'bbb',
          age: '18'
        });

        }
    });

    3。在/imports/api/links添加:

    export const StuCollection = new Mongo.Collection('student');

    4。新建文件\imports\ui\stu.jsx

    import React from 'react';
    import { useTracker } from 'meteor/react-meteor-data';
    import { StuCollection } from '../api/links';

    export const Stu = () => {
      const student = useTracker(() => {
        return StuCollection.find().fetch();
      });

      return (
       


         

    Students!


         
      {student.map(
              stu =>

    •           {stu.name}
             

    •       )}

       

     );
    };

    5。在\imports\ui\App.jsx添加:

    import { stu } from './stu.jsx';

    export const App = () => (
     


       

    Welcome to Meteor!


       
       
       
     

    );

  • 相关阅读:
    国庆出游远程实测:ToDesk 、TeamViewer、AnyDesk远程控制软件稳定性
    【Leetcode HOT100】和为 K 的子数组 c++
    Effective C++改善程序与设计的55个具体做法 1. 让自己习惯 c++
    涟源举办系列文旅活动推动湖南文旅产业发展!
    【phpMyadmin】MYSQL突破secure_file_priv写shell提权
    咪唑基离子液体EMIM[PF6],EMIM[BF4],EMIM[Tf2N],BMIM[PF6],HMIM[PF6],[VBMIM][PF6]改性水性聚氨酯
    【C++】template方法undefined reference to(二):C++代码的编译过程
    uniapp:谷歌地图,实现地图展示,搜索功能,H5导航
    【练习赛】2022年高教杯数学建模C题(第一题的第一小问)
    一站式工单系统哪家好?一站式工单系统有什么特点?
  • 原文地址:https://blog.csdn.net/zm_21/article/details/125990983
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号