Quasar - adding a Pinia Store creates a VUex store - quasar

I can't solve this issue, always going back to the same issue. When I run quasar new store stores it creates files that are no match to a current quasar documentation, containing files like for vuex store:
store
stores
- action.js
- getters.js
- index.js
- mutation.js
- state.js
- index.js
But expected to have pinia and all files related to pinia:
.
└── src/
└── stores/ # Pinia
├── index.js # Pinia initialization
├── <store> # Pinia store...
└── <store> # Pinia store...
This is my package.json:
{
"name": "client-profile",
"version": "0.0.1",
"description": "Lambda Client Profile App",
"productName": "Client Profile",
"author": "Branislav Papulin <branislav.papulin#nephelesolutions.com>",
"private": true,
"scripts": {
"lint": "eslint --ext .js,.vue ./",
"test": "echo \"No test specified\" && exit 0",
"build": "quasar build"
},
"dependencies": {
"#aws-amplify/ui-components": "^1.9.6",
"#quasar/app": "^3.3.3",
"#quasar/cli": "^1.3.2",
"#quasar/extras": "^1.14.1",
"aws-amplify": "^4.3.12",
"aws-sdk": "^2.1117.0",
"aws-xray-sdk": "^3.3.5",
"core-js": "^3.6.5",
"pinia": "^2.0.14",
"quasar": "^2.7.3"
},
"devDependencies": {
"#babel/eslint-parser": "^7.13.14",
"eslint": "^7.14.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-vue": "^7.0.0",
"eslint-webpack-plugin": "^2.4.0"
},
"browserslist": [
"last 10 Chrome versions",
"last 10 Firefox versions",
"last 4 Edge versions",
"last 7 Safari versions",
"last 8 Android versions",
"last 8 ChromeAndroid versions",
"last 8 FirefoxAndroid versions",
"last 10 iOS versions",
"last 5 Opera versions"
],
"engines": {
"node": ">= 12.22.1",
"npm": ">= 6.13.4",
"yarn": ">= 1.21.1"
}
}
And in node_modules I can see pinia is installed, but when I run quasar info I don't see it installed:
Operating System - Linux(5.4.0-100-generic) - linux/x64
NodeJs - 16.13.0
Global packages
NPM - 8.4.1
yarn - 1.22.4
#quasar/cli - 1.3.2
#quasar/icongenie - Not installed
cordova - Not installed
Important local packages
quasar - 2.7.3 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
#quasar/app - 3.3.3 -- Quasar Framework local CLI
#quasar/extras - 1.14.1 -- Quasar Framework fonts, icons and animations
eslint-plugin-quasar - Not installed
vue - 3.2.37 -- The progressive JavaScript framework for building modern web UI.
vue-router - 4.0.16
vuex - Not installed
electron - Not installed
electron-packager - Not installed
electron-builder - Not installed
Should be pinia included as well.

Same issue... tried updating quasar, cli, and pinia. I can even build a new clean quasar app with npm init quasar and select Pinia and it then creates a stores path but quasar new store storename still uses vuex... I can't even get vuex to uninstall (os x platform with vs code). quasar info still shows it.
The only solution I found is to add the path to stores in quasar.config.js:
sourceFiles: {
store: "src/stores/index",
},
I believe this has broken in the last couple months because I have been using pinia in my project without issue and then suddenly it couldn't find it in the "stores" path and was expecting index.js to be in a "store" directory instead.

Make sure to not only remove the vuex entry in the package.json but actually uninstall it.
In the project folder, call:
yarn: uninstall vuex
yarn remove vuex
npm: uninstall vuex
npm uninstall vuex
This will also remove it from the package.json.
After uninstalling I could also remove the sourceFiles entry in quasar.config.js.
Result in console:
quasar new store demo
App • Generated store: src\stores\demo.js

Related

The required JS dependency "readable-stream/writable.js" is not available, it was required by "node_modules/stream-browserify/index.js"

I am getting this error when trying to build a Clojurescript project with shadow-cljs. I've tried looking for syntax errors as described here but I can get the same the error with a single line and a single import although not all imports cause the same error.
This compiles:
(ns campfire.core)
(defn init [] (println "ok"))
This doesn't:
(ns campfire.core
(:require ["bugout" :as b]))
(defn init [] (println "ok"))
The output from the above example is:
shadow-cljs - config: /home/ru/Projects/campfire/shadow-cljs.edn
shadow-cljs - HTTP server available at http://localhost:3000
shadow-cljs - server version: 2.11.18 running at http://localhost:9630
shadow-cljs - nREPL server started on port 8777
shadow-cljs - watching build :frontend
[:frontend] Configuring build.
[:frontend] Compiling ...
[:frontend] Build failure:
The required JS dependency "readable-stream/writable.js" is not available, it was required by "node_modules/stream-browserify/index.js".
Dependency Trace:
campfire/core.cljs
node_modules/bugout/index.js
node_modules/bs58check/index.js
node_modules/create-hash/browser.js
node_modules/cipher-base/index.js
node_modules/stream-browserify/index.js
Searched for npm packages in:
/home/ru/Projects/campfire/node_modules
See: https://shadow-cljs.github.io/docs/UsersGuide.html#npm-install
package.json
{
"name": "campfire",
"version": "0.0.1",
"private": true,
"scripts": {
"build": "shadow-cljs release frontend"
},
"devDependencies": {
"shadow-cljs": "2.11.18"
},
"dependencies": {
"bugout": "^0.0.10",
"webtorrent": "^0.114.1"
}
}
shadow-cljs.edn
{:source-paths
["src/dev"
"src/main"
"src/test"]
:dependencies
[]
:dev-http {3000 "public"}
:nrepl {:port 8777}
:builds
{:frontend
{:target :browser
:modules {:main {:init-fn campfire.core/init}}}}}
I've seen similar build errors that were fixed by clearing .shadow-cljs etc and rebuilding but nothing like that seems to be helping. I'm new to shadow so apologies if this is something obvious. Does anyone have any idea what's going on here?
Update
So it looks like what's happening is that stream-browserify 2.0.2 requires readable stream ^2.0.2 which npm installs in the nested node_modules folder. Elsewhere readable-stream 3.6.0 is being installed in top level node_modules. Shadow is trying to resolve writer.js against the 3.6.0 version of readable stream instead of the 2.0.2 version.
Confusingly though, stream-browserify isn't a dependency of cipher-base as given in the dependency trace but of node-libs-browser which is itself a dependency of shadow-cljs.
Is it possible that this is a bug in shadow or is it expected behaviour?
Update 2
I've created an example repo that replicates what I'm seeing as simply as I can here.
Did you actually install the shadow-cljs dependency in the project? Does the directory node_modules/shadow-cljs exist?
I see it listed in devDependencies so it should be installed but it might not be if you never actually called npm install in the project or npm is set to production mode which won't install devDependencies. All of this is part of the node-libs-browser package which seems to be missing as well and should have been installed due to being a dependency of shadow-cljs.
Based on the link in your first error message, it says to npm install whatever's missing.
If you didn't run npm install, that by itself will install what's in your package.json.
If that's not the issue, then npm i readable-stream may help.

Task 'installDebug' not found in root project 'Android'

"I'm using command line to build android project but gradlew installDebug command is giving an error. Showing Task 'installDebug' not found in root project 'Android'"
My top-level build.gradle file:-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My Module-level build.gradle file is:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
applicationId "com.avinash.myapplication"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:appcompat-v7:25.3.1'
}
Step 1 :
Don't use react-native run-android.
Step 2 :
If you are using Windows and you don't have the file gradlew.bat (but only gradlew), download it from here or copy it from an another react-native project.
Step 3 :
In directory /android execute the command gradlew tasks or gradlew.bat tasks if you are on Windows.
Check the commands that can be used in Install tasks
Install tasks
-------------
installDevKernelDebug - Installs the DebugDevKernel build.
installDevKernelDebugAndroidTest - Installs the android (on device) tests for the DevKernelDebug build.
installProdKernelDebug - Installs the DebugProdKernel build.
installProdKernelDebugAndroidTest - Installs the android (on device) tests for the ProdKernelDebug build.
uninstallAll - Uninstall all applications.
uninstallDevKernelDebug - Uninstalls the DebugDevKernel build.
uninstallDevKernelDebugAndroidTest - Uninstalls the android (on device) tests for the DevKernelDebug build.
uninstallDevKernelRelease - Uninstalls the ReleaseDevKernel build.
uninstallProdKernelDebug - Uninstalls the DebugProdKernel build.
uninstallProdKernelDebugAndroidTest - Uninstalls the android (on device) tests for the ProdKernelDebug build.
uninstallProdKernelRelease - Uninstalls the ReleaseProdKernel build.
Use the command gradlew installDevKernelDebug.
Step 4 :
If you are using react-native, go in the root directory and run npm start or expo start if you are using expo.
In the browser go to http://localhost:19002 (or the port it says on your console).
Select the local connection and recover the value like
expXXXXXXXXXXXXXXXXXXX://127.0.0.1:19000.
Check the file on .\android\app\src\main\java\host\exp\exponent\generated\DetachBuildConstants.java and copy the value in DEVELOPMENT_URL variable.
Step 5 :
Exit Metro Bundler with CTRL+C on the console.
Step 6 :
Run cd android to enter ./android/ directory
Step 7 :
Run gradlew installDevKernelDebug or other task you listed on Step 3.
I found most of these directions on this thread: https://github.com/expo/expo/issues/4097
You might be missing the Android NDK, can try to install it using the SDK Manager of Android-Studio.
For details can refer to: https://stackoverflow.com/a/58987549/1435026

"ng generate application xyz" CLI not woking

I am trying to add an application to existing project but it's failing when running "ng generate application xyz". Error is:
Schematic input does not validate against the Schema: {"sourceDir":"app","prefix":"app","style":"css","theme":true,"webpack":true}
Errors:
Data path "" should have required property 'name'.
I then used "ng generate application --name=xyz" and the full blown subproject was created but I get the error when I run "ng serve xyz" which says "Project 'xyz' could not be found in workspace.". I Googled but I found nothing matching my problem. All examples generate libraries but I want to generate application not library.
Do I need to manually add the newly generated sub project settings to parent angular.json file?
ng -v
Angular CLI: 6.1.5
Node: 8.11.3
OS: win32 x64
Angular: 6.1.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.7.5
#angular-devkit/build-angular 0.7.5
#angular-devkit/build-optimizer 0.7.5
#angular-devkit/build-webpack 0.7.5
#angular-devkit/core 0.7.5
#angular-devkit/schematics 0.7.5
#angular/cli 6.1.5
#ngtools/webpack 6.1.5
#schematics/angular 0.7.5
#schematics/update 0.7.5
rxjs 6.3.1
typescript 2.7.2
webpack 4.9.2
According to this you need to add a --name flag in the older version of the cli.
ng generate application --name xyz
And it seems to be a fixed issue.

Importing angular-translate imports an empty object

I'm using JSPM 0.16.42 which uses SystemJS, I've tried both angular-translate and angular-route, both of which are on github endpoints.
However, for both of them angular throws the same error
argument module is not a function
when using them in ES6 syntax as follows:
import AngularRoute from 'angular-route';
angular.module('app', [AngularRoute]);
I'm using babel as a transpiler. The object I get back from the import seems to be empty. Following is the relevant part of my config.js file:
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},
map: {
"angular-route": "github:angular/bower-angular-route#1.5.8",
"angular-translate": "github:angular-translate/bower-angular-translate#2.11.1",
}...
EDIT: When I tried to install angular-translate with an npm endpoint I got the error http://errors.angularjs.org/1.5.8/$injector/unpr?p0=e
on the following line in angular.js
return new ErrorConstructor(message);
which I guess is a bit of progress but still doesn't solve my issue obviously
EDIT#2: I got angular-route to work with the help of #artem by using the npm endpoint, for some reason the github endpoint did not work so I used jspm install npm:angular-route. Further investigation is needed as to why the github package did not work and the npm package did
EDIT#3: I have overriden the package configuration as you can see below, though that didn't help
"npm:angular-translate#2.11.1": {
"format": "global",
"dependencies": {
"angular": ">=1.2.26"
},
"shim": {
"angular-translate": {
"deps": "angular"
}
}
}
I eventually fixed it by installing angular-translate as well as angular-route via their npm endpoints instead of the default (github) endpoints, using
jspm install npm:angular-route
&
jspm install npm:angular-translate -o '{dependencies: { angular: ">=1.2.26" } }'
The override for angular-translate was needed since jspm did not understand the original dependency syntax correctly which was angular: ">= 1.2.26 <=1.6" as described in this github issue
Here is not-so-minimal, not-really-self-contained example for angular-translate with systemjs:
npm install jspm
./node_modules/.bin/jspm install github:angular-translate/angular-translate
keep pressing <ENTER>, accepting all the default values
create file test.js
import AngularTranslate from 'angular-translate/angular-translate';
console.log(AngularTranslate);
create file index.html
<!doctype html>
<html>
<head>
<script src="jspm_packages/system.src.js"></script>
<script src="config.js"></script>
<script>
System.import('./test.js');
</script>
</head>
<body>
</body>
</html>
open it in the browser:
Failed to load resource: the server responded with a status of 404 (File not found)
undefined:1 Uncaught (in promise) Error: (SystemJS) XHR error (404 File not found) loading
http://localhost:8035/jspm_packages/github/angular-translate/angular-translate#2.11.1.js(…)
Why that file isn't there? It's supposed to be created by jspm, if you had installed angular-translate from npm it would have contained
module.exports = require("npm:angular-translate#2.11.1/dist/angular-translate.js");
which is just a redirect from symbolic package name (the name of that .js file) to that package main file, as specified in package.json:
"main": "dist/angular-translate.js",
But angular-translate is from github, there is no dist there. That's why jspm did not create the redirect file - there is nothing to redirect to.
No problem, just build it from the source we got from github:
cd jspm_packages/github/angular-translate/angular-translate#2.11.1/
npm install
npm run-script build
cd ../../../..
and fix mapping in config.js:
map: {
"angular-translate/angular-translate": "github:angular-translate/angular-translate#2.11.1/dist/angular-translate",
open index.html in the browser again:
system.src.js:122 Uncaught (in promise) Error: (SystemJS) angular is not defined(…)
No problem, angular is already installed as angular-translate dependency, just tell systemjs when and how to load it.
add to config.js:
meta: {
"angular-translate/angular-translate": {
"deps": ["angular"]
}
},
map: {
"angular": "github:angular-translate/angular-translate#2.11.1/node_modules/angular/angular",
NOTE: You don't need to specify format for angular-translate. SystemJS auto-detects it correctly - it could be loaded as either 'amd' or 'cjs', but it will not work as 'global'. Also, you probably did not start by installing angular-translate, so you already have angular.js file and mapping in place somewhere.
Open index.html in the browser again. It prints in the console:
pascalprecht.translate
Yes angular-translate exports a string - seems to be typical for angular1 modules.
I have no experience with angular.js, so I declare it a success and stop here.
PS Why angular-route worked when you install it from npm, and did not work from github?
When installed from npm, jspm created a file named jspm_packages/npm/angular-route#1.5.8.js, containing
module.exports = require("npm:angular-route#1.5.8/index.js");
because package.json for angular-route has
"main": "index.js",
which is correct and works for you.
When installed from github, jspm created similar file jspm_packages/github/angular/bower-angular-route#1.5.8.js, but this time it points to a different file
module.exports = require("github:angular/bower-angular-route#1.5.8/angular-route");
because someone put an override in jspm registry there at https://github.com/jspm/registry/blob/master/package-overrides/github/angular/bower-angular-route%401.3.0.json
because bower.json for bower-angular-route has
"main": "./angular-route.js",
Maybe it's an oversight, maybe it's correct and works for them - I don't know.
TL;DR It's not a good idea to use package manager for installing software, if the software was not packaged properly for that package manager.

NPM does not publish dependencies

I have been fooling around with Node and npm Packages as CLI applications. I have a project with a package.json, all filled in correctly. When I run the application with different arguments via WebStorm, it all works fine. If I publish the npm package however... there are no dependencies... the npm site can't find one.. and when I install the CLI application, it fails running because yeah... the dependencies aren't pulled in...
This is my package.json
{
"name": "wmg",
"version": "0.0.8",
"description": "A Commandline Foolin around",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/Arvraepe/wmg.git"
},
"keywords": ["Stuff", "Foolin"],
"target": "main",
"preferGlobal": true,
"bin": {
"wmg": "wmg.js"
},
"author": "Arne Van Raepenbusch <arvraepe#gmail.com>",
"license": "ISC",
"devDependencies": {
"prompt": "^0.2.14",
"restify": "^3.0.3",
"underscore": "^1.8.3"
}
}
I tried running pakmanager deps, but that gave me this strange error
======================= WARNING =======================
Assuming browser mode by default is deprecated.
Include browserDependencies in your package.json
-- OR --
pakmanager -e browser build
In the next release of pakmanager, the node environment will be assumed as default
=======================================================
Targeted Environment: browser
[[[deps]]]
[ERROR] The following packages are `require`d, but not in the package, nor on npm:
wmg
pakmanager {}
======================= WARNING =======================
Assuming browser mode by default is deprecated.
Include browserDependencies in your package.json
-- OR --
pakmanager -e browser build
In the next release of pakmanager, the node environment will be assumed as default
=======================================================
Surely my package isn't supposed to be dependent on itself?
Can someone shed some more light on this?
I looked at your package, and as others have noted you have devDependencies listed but no dependencies. Typically devDependencies is for things like test frameworks, which you need to work on the package but not to use it. Both prompt and restify are used in your app and should be listed in a dependencies object instead of devDependencies.
Your package.json file contains no dependencies. Only devDependencies which npm assumes are required only for development (mocha for example) and are not required for installation.
If any of your devDependencies are actual user dependencies move them to dependencies.