Giter Site home page Giter Site logo

ionic-team / create-capacitor-app Goto Github PK

View Code? Open in Web Editor NEW
5.0 10.0 5.0 430 KB

Create a new Capacitor app ⚡️

License: Other

JavaScript 33.39% TypeScript 58.87% CSS 0.29% HTML 7.46%
capacitor cross-platform java javascript html css swift ios android pwa

create-capacitor-app's Introduction

Create Capacitor App

Create a minimal (no JS framework) Capacitor app.

Usage

npm init @capacitor/app [<path>] -- [options]

📝 npm init <pkg> requires npm 6+

You can also try the following methods to use this package:

  • npx @capacitor/create-app [<path>] [options]
  • yarn create @capacitor/app [<path>] [options]
  • npm install -g @capacitor/create-app && create-capacitor-app [<path>] [options]

Options

--name <name> ............. Human-friendly app name
--app-id <id> ............. Unique app ID in reverse-DNS notation

create-capacitor-app's People

Contributors

imhoffd avatar it-mikes avatar jcesarmobile avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-capacitor-app's Issues

Still using release candiate version of capacitor 3's cli tools

Run the following commands in a new folder:

npm init @capacitor/app
# enter default suggestions when asked by command above
cd my-app
npm install
npx cap doctor

What I expect:

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 3.0.0
  @capacitor/core: 3.0.0
  @capacitor/android: 3.0.0
  @capacitor/ios: 3.0.0

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/ios: not installed
  @capacitor/cli: 3.0.0
  @capacitor/core: 3.0.0

What I see:

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 3.0.0
  @capacitor/core: 3.0.0
  @capacitor/android: 3.0.0
  @capacitor/ios: 3.0.0

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/ios: not installed
  @capacitor/cli: 3.0.0-rc.4
  @capacitor/core: 3.0.0

App does not start correctly after initial setup.

The Info

@capacitor/android: not installed
@capacitor/ios: not installed
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0


❯ npm --version 8.5.0
❯ node --version v16.14.2


The Issue:

After create-app script and npm install I run npm start.

The dev server launches and wehn I visit the localhost:3000 I get greeted with following error:

Compiled with problems:X

ERROR in ./src/pages/dashboard.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /app/src/pages/dashboard.js: Unexpected token, expected "," (10:20)

   8 |     return (
   9 |         {
> 10 |             messages.map((message, i) => {
     |                     ^
  11 |                 return <Message key={i}
  12 |                                 title={messages[i]["title"]}
  13 |                                 author={messages[i]["author"]}
    at instantiate (/app/node_modules/@babel/parser/lib/index.js:72:32)
    at constructor (/app/node_modules/@babel/parser/lib/index.js:358:12)
    at Parser.raise (/app/node_modules/@babel/parser/lib/index.js:3335:19)
    at Parser.unexpected (/app/node_modules/@babel/parser/lib/index.js:3373:16)
    at Parser.expect (/app/node_modules/@babel/parser/lib/index.js:4002:28)
    at Parser.parseObjectLike (/app/node_modules/@babel/parser/lib/index.js:13486:14)
    at Parser.parseExprAtom (/app/node_modules/@babel/parser/lib/index.js:12890:23)
    at Parser.parseExprAtom (/app/node_modules/@babel/parser/lib/index.js:8034:20)
    at Parser.parseExprSubscripts (/app/node_modules/@babel/parser/lib/index.js:12540:23)
    at Parser.parseUpdate (/app/node_modules/@babel/parser/lib/index.js:12519:21)


ERROR


src/pages/dashboard.js
  Line 10:20:  Parsing error: Unexpected token, expected "," (10:20)

Screenshot :

image

App doesn't work after start

Instructions described in bootstrapped app are not complete in order to start it.
After opening http://localhost:5000/www/ in browser, fatal errors prevent app execution:

Uncaught TypeError: Cannot read properties of undefined (reading 'hide')
    at new <anonymous> (capacitor-welcome.js:7)
    at capacitor-welcome.js:1
GET http://localhost:5000/www/assets/imgs/logo.png 404 (Not Found)
Error while trying to use the following icon from the Manifest: http://localhost:5000/www/assets/imgs/logo.png (Download error or resource isn't a valid image)

Suggested fixes:

  • The index.html file should reference plugins:

    <script src="../node_modules/@capacitor/splash-screen/dist/plugin.js"></script>
    <script src="../node_modules/@capacitor/camera/dist/plugin.js"></script>
  • After running npx serve user should visit http://localhost:5000/www/

  • The assets/imgs/logo.png file is missing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.