quasar-testing
quasar-testing copied to clipboard
[@quasar/testing-quality] Unknown command "serve" when executing serve:test:lighthouse
Software version
"devDependencies": {
"@quasar/app": "^1.0.0-rc.6",
"@quasar/quasar-app-extension-testing": "^1.0.0",
"@quasar/quasar-app-extension-testing-e2e-cypress": "^1.0.0-beta.10",
"@quasar/quasar-app-extension-testing-quality": "^1.0.0-beta.8",
What did you get as the error?
$ yarn run serve:test:lighthouse
yarn run v1.16.0
$ quasar serve test/lighthouse/reports/ --port 8789
app Unknown command "serve" +2ms
Please note that running directly did work:
$ quasar serve test/lighthouse/reports/ --port 8789
# worked...
What version Quasar are you using?
"dependencies": {
"@quasar/extras": "^1.1.4",
"quasar": "^1.0.0-rc.4",
$ quasar -v
1.0.0-rc.7
I think that when executing yarn run it takes node_modules/.bin/quasar (1.0.0-rc.4) instead of /usr/local/bin/quasar (1.0.0-rc.7)
This works:
$ quasar serve test/lighthouse/reports/ --port 8789
please show me the results of
quasar info
(because quasar serve has been around for some time now)
$ quasar info
Operating System - Darwin(17.7.0) - darwin/x64
NodeJs - 12.3.1
Global packages
NPM - 6.9.0
yarn - 1.16.0
@quasar/cli - 1.0.0-rc.2
cordova - Not installed
Important local packages
quasar - 1.0.0-rc.5 -- High performance, Material Design 2, full front end stack with Vue.js -- build SPA, SSR, PWA, Hybrid Mobile Apps and Electron apps, all simultaneously using the same codebase
@quasar/app - 1.0.0-rc.7 -- Quasar Framework App CLI
@quasar/extras - 1.1.4 -- Quasar Framework fonts, icons and animations
vue - 2.6.10 -- Reactive, component-oriented view layer for modern web interfaces.
vue-router - 3.0.6 -- Official router for Vue.js 2
vuex - 3.1.1 -- state management for Vue.js
electron - Not installed
electron-packager - Not installed
electron-builder - Not installed
@babel/core - 7.4.5 -- Babel compiler core.
webpack - 4.34.0 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
webpack-dev-server - 3.7.2 -- Serves a webpack app. Updates the browser on changes.
workbox-webpack-plugin - 4.3.1 -- A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache.
register-service-worker - 1.6.2 -- Script for registering service worker, with hooks
Quasar App Extensions
quasar-app-extension-ide-helper - 0.0.5 -- Quasar framework extension which enables IDE features like autocomplete by generating helper files for IDE to index.
@quasar/quasar-app-extension-testing - 1.0.0 -- A Quasar App Extension for managing Test Harnesses
@quasar/quasar-app-extension-testing-e2e-cypress - 1.0.0-beta.10 -- A Quasar App Extension for Cypress e2e
quasar-app-extension-draggable - 0.2.2 -- A Quasar extension that makes elements draggable and movable with keyboard.
@quasar/quasar-app-extension-testing-quality - 1.0.0-beta.8 -- A Quasar App Extension for Code Quality
Networking
Host - toshalev-mbp
en0 - 172.22.220.69
en4 - 172.22.218.75
I added the following package.json script:
"quasar:version": "quasar -v"
And ran it:
$ yarn run quasar:version
yarn run v1.16.0
$ quasar -v
1.0.0-rc.7
✨ Done in 0.22s.
$ quasar -v
1.0.0-rc.7
So both are the same version, but this works:
$ quasar serve test/lighthouse/reports/ --port 8789`
and this doesn't:
$ yarn run serve:test:lighthouse
yarn run v1.16.0
$ quasar serve test/lighthouse/reports/ --port 8789
app Unknown command "serve" +2ms
That's weird...
In node_modules/@quasar/app/bin/quasar clearly there is no serve command. This is the file that gets called by yarn run ..., but it is not called when running $ quasar ... directly from shell:
const commands = [
'dev',
'build',
'clean',
'inspect',
'describe',
'ext',
'run',
'mode',
'info',
'new',
'test',
'help'
]
let cmd = process.argv[2]
if (cmd) {
# ...
if (commands.includes(cmd)) {
process.argv.splice(2, 1)
}
else {
# ...
warn(`Unknown command "${ cmd }"`)
The global quasar command, on the other hands, has a completely different implementation:
$ head -n 30 `which quasar`
#!/usr/bin/env node
let cmd = process.argv[2]
... if (cmd === 'serve') {
process.argv.splice(2, 1)
require(`./quasar-serve`)
}
@rstoenescu - Do you have any insight into why this might be happening and what we can do to get around it?
The issue is cause due to yarn run command prepends the path of node_modules/.bin to PATH environment variable.
https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/run.js#L52
$ cat print_path.sh
#!/usr/bin/env bash
echo $PATH | sed 'y/:/\n/'
$ cat package.json
"scripts": {
...
"run_print_path": "yarn run print_path.sh",
...
$ print_path.sh > from_shell
$ yarn run run_print_path > from_yarn
$ \diff -y from_shell from_yarn
$ \diff -y from_shell from_yarn
> yarn run v1.16.0
> $ yarn run print_path.sh
> $ /Users/toshalev/git/msm-admin/node_modules/.bin/print_path.
/Applications/Wireshark.app/Contents/MacOS /Applications/Wireshark.app/Contents/MacOS
/Library/Application Support/teradata/client/16.20/bin /Library/Application Support/teradata/client/16.20/bin
> /Users/toshalev/.config/yarn/link/node_modules/.bin
> /Users/toshalev/.config/yarn/link/node_modules/.bin
/Users/toshalev/.rbenv/shims /Users/toshalev/.rbenv/shims
/Users/toshalev/bin /Users/toshalev/bin
/Users/toshalev/git/msm-admin/node_modules/.bin /Users/toshalev/git/msm-admin/node_modules/.bin
> /Users/toshalev/git/msm-admin/node_modules/.bin
> /Users/toshalev/git/msm-admin/node_modules/.bin
/Users/toshalev/go/bin /Users/toshalev/go/bin
/bin /bin
/opt/X11/bin /opt/X11/bin
/sbin /sbin
/usr/bin /usr/bin
> /usr/local/Cellar/node/12.3.1/bin/node_modules/npm/bin/node-g
> /usr/local/Cellar/node/12.3.1/bin/node_modules/npm/bin/node-g
> /usr/local/Cellar/node/12.3.1/lib/node_modules/npm/bin/node-g
> /usr/local/Cellar/node/12.3.1/lib/node_modules/npm/bin/node-g
> /usr/local/Cellar/node/12.3.1/libexec/lib/node_modules/npm/bi
> /usr/local/Cellar/node/12.3.1/libexec/lib/node_modules/npm/bi
/usr/local/bin /usr/local/bin
/usr/local/bin /usr/local/bin
/usr/local/opt/sqlite/bin /usr/local/opt/sqlite/bin
/usr/local/sbin /usr/local/sbin
/usr/sbin /usr/sbin
> /var/folders/m5/bjzmrtgn68gfbm_pg4_bdhym0000gq/T/yarn--156284
> /var/folders/m5/bjzmrtgn68gfbm_pg4_bdhym0000gq/T/yarn--156284
> Done in 0.40s.
Hey, its not related with yarn. Check my post for test cases: https://forum.quasar-framework.org/topic/4799/quasar-app-extension-serve-is-missing-error
Still getting this issue with latest quasar CLI (v1.5.0) and a freshly baked "quasar create" project.
For this new project I'm using npm (v6.4.1) instead of yarn and I get the same error.
I want to serve command serve through package.json-dependancy. Not global quasar/cli.
To solve this problem I am using @quasar/cli as devDependencies.
npm i -D @quasar/cli
I also encountered this for serve:test:coverage and serve:test:lighthouse. I'm not exactly clear where these commands fit into my workflow yet.
Seems like the workaround is to run the quasar serve test/jest/coverage/lcov-report/ --port 8788 command directly in the shell.
Have same problem just trying to run basic quasar serve from cmd. Both local and global installs of quasar are 3.3.3, both have @quasar/app and @quasar/cli. My guess is it tries to use only what's inside app while serve is not there, but in cli.
Running quasar from @quasar/cli is the only way I've managed to start it without diving too deep:
node node_modules\@quasar\cli\bin\quasar serve
Because general quasar from mode_nodules/.bin directs to @quasar/app which somehow has no idea about cli.
I can confirm: both @quasar/cli and @quasar/app* packages expose a quasar bin
While @quasar/cli delegates to @quasar/app for unknown commands when into a Quasar project, it doesn't work the same viceversa
This results in quasar serve not working when executed from a package.json scripts
With yarn you can use $(yarn global bin)/quasar serve ...
This results in quasar serve not working when executed from a package.json scripts
I've tried to add a script "quasar:serve": "quasar serve ", to my package.json yet npm run quasar:serve still complains Quasar App Extension "serve" is missing....
With yarn you can use
$(yarn global bin)/quasar serve
You mean kinda like this: >c:\Users\Monty\AppData\Roaming\nvm\v16.14.0\quasar.cmd serve? Didn't work for me, yells at this part (running without .cmd gives the same result):
#!/usr/bin/env node
^
SyntaxError: Invalid or unexpected token
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Trying to run node _that_path_to_global_node_ gives error, just a different one:
c:\Users\Monty\AppData\Roaming\nvm\v16.14.0\quasar:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
I mean I can live with that, I'm a backender, just have to run quasar from time to time to test some things on my side. But running dev was too costly (1.5 to 3.2 GB of RAM+swap just for that) for debug functions I don't really need, so tried to run serve. Wrote here just in case someone like me won't find a simple-ish solution.
Not sure about how to make it work on Windows as I use Ubuntu in my day-to-day development
Have you tried npx quasar serve instead?
Another possibility is to install the quasar/cli locally, even if some features will break, e.g. quasar info
Have you tried
npx quasar serveinstead?
Yep, doesn't work:
C:\Users\Monty\Documents\Work\_front\aqueue>npx quasar serve
App • Looking for Quasar App Extension "serve" command
App • ⚠️ Quasar App Extension "serve" is missing...
nother possibility is to install the quasar/cli locally, even if some features will break, e.g.
quasar info
Both are installed globally and locally.
Both are installed globally? Which other is installed globally aside @quasar/cli? All other packages aren't meant to be global
Installed globally:
+-- @quasar/[email protected]
+-- @quasar/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
Installed locally for this project:
"dependencies": {
"@quasar/cli": "^1.3.2",
"@quasar/extras": "^1.15.1",
"@quasar/quasar-ui-qcalendar": "^v4.0.0-beta.15",
"axios": "^0.27.2",
"babel-loader": "^8.2.5",
"core-js": "^3.22.1",
"quasar": "^2.7.7",
"swiper": "^8.1.1",
"vue": "^3.2.39",
"vue-i18n": "~9.0.0",
"vue-router": "^4.1.3 ",
"vuex": "^4.0.2"
},
"devDependencies": {
"@babel/eslint-parser": "^7.18.9",
"@babel/core": "^7.18.10",
"@quasar/app": "^3.3.3",
"@types/node": "^18.6.3",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"eslint": "^8.21.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-vue": "^8.7.1",
"ts-vue-plugin": "^0.1.3",
"workbox-webpack-plugin": "^6.5.4",
"webpack": "^5.74.0",
"typescript": "^4.7.4"
},
Please remove @quasar/app from your globally installed packages, possibly remove typescript too as having it globally available could cause problems with local projects which don't support that TS version