There is no 'package.json' - node-webkit app - node-webkit

I'm making my first desktop application using node-webkit.
I followed all the steps to package the app on windows but I'm getting this error:
There is no 'package.json' in the package, please make sure the 'package.json' is in the root of the package.
Although the package is in the root.

sample package.json file
{
"name": "name of app",
"version": "1.0.0",
"main": "index.html",
"single-instance": true,
"node-remote": "<local>",
"window": {
"title": "name to show in title bar",
"icon": "icon to show in titlebar",
"position": "center",
"min_width": 1024,
"min_height": 600,
"toolbar": true,
"width": 1362,
"height": 768
},
"dependencies": {
"express": "3.x"
},
"webkit": {
"plugin": true
}
}

Ok I found my mistake. In fact, I was compressing the folder containing the package json and the other files. So what I made was like that:
App.zip
|
|-App
|-package.json
|-Other files
What is correct is this:
App.zip
|-package.json
|-Other files

Related

Error: "ios.bundleIdentifier" is not defined in your app.config.js and we can't update this file programmatically. Add the value

I am trying to deploy a React Native App using eas build.
The app builds successfully on Android but not on IOS.
I see this error message which says ios.bundleIdentifier is not defined in app.config.js
But... it IS defined, as can be seen here:
import 'dotenv/config';
export default {
"name": "raterepositoryapp",
extra: {
env: process.env.ENV,
uri: process.env.APOLLO_URI
},
"expo": {
"extra": {
"eas": {
"projectId": "ecf6c94b-c096-4a5b-ab41-8dfdd36de96b"
}
}
},
"slug": "rate-repository-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.webforprofessionals.rate-repository-app",
"buildNumber": "1.0.0"
},
"android": {
"package": "com.webforprofessionals.raterepositoryapp",
"versionCode": 1,
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
Why is the error coming up ?
I was able to finally discover the answer by using the EAS CLI command eas config --platform=ios --profile=preview (or whatever profile you want to test against). When you look at the output it gives you for app.config.js, you'll notice that there is no ios section shown and it's much smaller than your full app.config.js object. It is only using the eas portion of your app config.
I was able to fix the error by copying the ios config that's at the top-level of app.config.js into the expo portion of your config. I also moved the definition into a variable so I could use it in both places without repeating myself.
Edit:
After some more testing and documentation reading, I discovered what the real issue was. It appears that if you use app.config.js, the object you return is interpreted as the expo config... unless you also have an expo key inside that object. Then it only looks at what's in the expo part of your config. So what you really want to do is take your everything that's embedded under expo.extra and move it under extra.
Afterwards your app.config.js should look something like this:
export default {
name: "raterepositoryapp",
extra: {
env: process.env.ENV,
uri: process.env.APOLLO_URI,
eas: {
projectId: "ecf6c94b-c096-4a5b-ab41-8dfdd36de96b"
}
},
slug: "rate-repository-app",
// etc...
}
This is not obvious at all based on the error output, but after you realize which part of the file it's using, it's easy to address. I hope this works for you, too.
The documentation that tipped me off to this can be found here. You'll notice that wherever it uses the app.json format, you'll see everything nested under an expo key, but wherever it uses the app.config.js format, you'll see everything at the top-level of the object. That gave me the hint to start testing moving everything to the top level and do some testing.

Can a package be published to both github and npm? (with a single `npm publish`)

I got access to the github package registry beta, just fiddled with it and followed the configuration steps to publish.
The thing is, I published it correctly, but noticed it didn't publish to npm. Is there a way to publish in both registries with the same command? Does it make sense to have the package published in both registries?
Also, my package name in the package.json is #alvarocastro/quicksort (as stated in the doc) and the name in the github page ends up being that, but in the command example to install, the scope is duplicated, eg: #alvarocastro/#alvarocastro/quicksort
Here is the complete package.json file as a reference:
{
"name": "#alvarocastro/quicksort",
"version": "1.0.1",
"description": "An implementation of the quicksort algorithm",
"main": "index.js",
"scripts": {
"performance": "node performance.js",
"test": "xo && nyc ava",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"publishConfig": {
"registry":"https://npm.pkg.github.com/#alvarocastro"
},
"repository": {
"type": "git",
"url": "git+https://github.com/alvarocastro/quicksort.git"
},
"keywords": [
"quicksort",
"sort",
"algorithm"
],
"author": "Alvaro Castro",
"license": "MIT",
"bugs": {
"url": "https://github.com/alvarocastro/quicksort/issues"
},
"homepage": "https://github.com/alvarocastro/quicksort#readme",
"devDependencies": {
"ava": "2.3.0",
"coveralls": "3.0.6",
"nyc": "14.1.1",
"xo": "0.24.0"
}
}

vscode launch.json react-native & Haxe

I started moving from coding directly react-native project with Haxe.
Therefore the folder-structure has changed, that the react-native project files are in a subfolder of the current project.
When i do want to use the launch.json the output tells me (correctly) that there is no react-native npm package installed at root.
my launch.json looks like this now (tried to add rn-project-name) as a subfolder
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug iOS",
"program": "${workspaceRoot}/rn-project-name/.launch/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"target": "iPhone 5s",
"sourceMaps": true,
"outDir": "${workspaceRoot}/rn-project-name/.vscode/.react"
}
]
}
Has anyone ever had to solve something like this?
(I somehow do not understand how the launch.json sets up all neccessary file references)
I've managed to get it working. Just edit .vscode/settings.json adding the project root path:
{
...
"react-native-tools": {
"projectRoot": "path-to-your-rn-project"
}
}

window.print can't work in node-webkit

I hava a web project with express. when I convert the project to node-webkit use package.json
{
"name": "hello"
"main": "http://localhost:3001",
"node-main": "index.js",
"window": {
"toolbar": false,
"frame": true,
"width": 1170,
"height": 780
},
...
}
it can work well. but there is a button in one page, it will call window.print() on click and now it can't work in node-webkit application.
Any idea about what I am doing wrong? or are there any other solution to print the page?

Having trouble packaging node webkit app

I wrote a small app in node webkit, and am having trouble packaging it. My eventual goal is to have a .exe that I can give to other people.
I can run it from the command line with "nodewebkit".
I've tried zipping the files and saving the result as app.nw, but when I try to run that I just get the default node webkit screen. I've read through the docs on rogerwang github, but haven't gotten anywhere because I can't get through that first step.
The app consists of a few files: index.html, main.js, styles.css. It depends on a few node modules as well as jquery. The package.json file is pasted below... any suggestions would be much appreciated.
{
"name": "spl",
"version": "0.0.0",
"description": "",
"keywords": [],
"main": "index.html",
"homepage": "https://github.com/lpappone/spl",
"bugs": "https://github.com/lpappone/spl/issues",
"window": {
"title": "Splitter",
"toolbar": false,
"frame": true,
"width": 800,
"height": 500
},
"author": {
"name": "Lauren Pappone",
"email": "",
"url": "https://github.com/lpappone"
},
"repository": {
"type": "git",
"url": "git://github.com/lpappone/spl.git"
},
"dependencies": {
"fast-csv": "^0.5.3",
"recursive-readdir": "^1.2.0"
},
"devDependencies": {},
"engines": {
"node": ">=0.8.0"
}
}
The directory structure looks like this, and when I inspect the contents of the .nw, it is exactly the same:
You seem to be doing this on a Mac, so I'll cover that. Windows and Linux are slightly more complicated because they don't have App Bundles the way Mac OSX does.
Are you copying your app.nw to the right place? Are you sure you're including everything in app.nw?
Is this what you're doing?:
First you need to create app.nw, which is just a zip file of your entire project. If you go to your project dir (the one containing package.json) you can do this by typing
zip -r ../app.nw .
Now create a copy of node-webkit.app and copy app.nw into node-webkit.app/Contents/Resources/
cp app.nw node-webkit.app/Contents/Resources/
You should be able to run node-webkit.app now and it should run your app. (You might have some issues with security settings and such)
See https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps#mac-os-x for further details.