Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are no commands defined in the "jwt" namespace #143

Closed
c-myers1 opened this issue Mar 19, 2020 · 17 comments
Closed

There are no commands defined in the "jwt" namespace #143

c-myers1 opened this issue Mar 19, 2020 · 17 comments

Comments

@c-myers1
Copy link

Following the install steps, I'm stuck at

php artisan jwt:secret

It gives the error above. Googling, I came across this fix but it results in more errors.

How can I fix?

@tuandm
Copy link
Owner

tuandm commented Mar 19, 2020

@c-myers1 Sorry the doc is outdated. You should use the latest version on https://github.com/tuandm/laravue/blob/master/README.md

# Clone the project and run composer
composer create-project tuandm/laravue
cd laravue

# Migration and DB seeder (after changing your DB settings in .env)
php artisan migrate --seed

# Install passport
php artisan passport:install

# Install dependency with NPM
npm install

# develop
npm run dev # or npm run watch

# Build on production
npm  run production

I will update the document on doc.laravue.dev

@c-myers1
Copy link
Author

I actually went past this after posting by "composer require tymon/jwt-auth".

Currently at "yarn run dev" and its prompted me to update webpack-cli and now downloading stuff; currently at 687/1297.

I actually started with these instructions you posted but npm resulted in far too many errors so I followed your advise in the documentation "# Install dependency - we recommend using Yarn instead of NPM since we get errors while using NPM"

Will it fail with jwt or must I switch to passport? If I switch to passport, can I use yarn for the remaining instructions to avoid the npm issues?

@c-myers1
Copy link
Author

It eventually didn't work, errors below.

vagrant@homestead:~/code/laravue$ yarn run dev
yarn run v1.22.1
$ npm run development
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1584614445116-0.3299034522542337/node but npm is using /usr/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

laravue@0.6.0 development /home/vagrant/code/laravue
cross-env NODE_ENV=development BABEL_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:

  • webpack-cli (https://github.com/webpack/webpack-cli)
    The original webpack full-featured CLI.
    We will use "yarn" to install the CLI via "yarn add -D".
    Do you want to install 'webpack-cli' (yes/no): n
    You need to install 'webpack-cli' to use webpack via CLI.
    You can also install the CLI manually.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! laravue@0.6.0 development: cross-env NODE_ENV=development BABEL_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the laravue@0.6.0 development script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2020-03-19T10_40_46_916Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@tuandm
Copy link
Owner

tuandm commented Mar 19, 2020

@c-myers1 At this time, the npm issue has been fixed. You should be able to use npm or yarn to install Laravue.

Note: The lock file is generated by npm, you won't get warnings if you use it.

If you are using the latest code from github, you must go with Laravel passport which was integrated from Laravue@0.9.0. On the contrary, you have to go with JWT package.

If Laravel passport doesn't matter to you, I suggest you go with the latest code and npm.

Regards

@c-myers1
Copy link
Author

Thanks. Given the type of errors, it might be permission related. The command "composer create-project tuandm/laravue" actually gives the message "[ErrorException] mkdir(): Permission Denied."

I end up running all the commands with sudo (and I get warnings against this down the line.)

Will delete the folder and try afresh.

@tuandm
Copy link
Owner

tuandm commented Mar 21, 2020

@c-myers1 Please confirm if your issue is fixed or not.

@c-myers1
Copy link
Author

No its not. I have that very long list of errors i pasted 2 posts ago. A shame as the admin panel looks very good and I would love to get it working.

@tuandm
Copy link
Owner

tuandm commented Mar 24, 2020

@c-myers1 Sorry your errors confuse me. Can you reinstall the latest Laravue after clear npm/yarn cache and send here the error you get?

@c-myers1
Copy link
Author

I suppose with the —force flag? Will retry. However, I noticed every other laravel app created with composer has rwxrwxrwx permissions but only Laravue gets created with r-xr-xr-x. Could the errors be due to this? Is there a flag to run composer with or I have to manually change permissions?

@c-myers1
Copy link
Author

I guess it shouldn’t since the current setting gives the owner full rwx.

@tuandm
Copy link
Owner

tuandm commented Mar 26, 2020

@c-myers1: Yes, it shouldn't be full rwx in any case. Can you please take the screenshot or post full error messages here? I'm just curious :).

@c-myers1
Copy link
Author

c-myers1 commented Mar 29, 2020

I just ran yarn cache clear and npm cache verify. Then composer create-project tuandm/laravue.

I get the error [ErrorException] mkdir(): Permission denied so I used sudo for this and everything else (despite a warning to avoid sudo) since I'm just evaluating.

Next, the passport install failed due to this error: There are no commands defined in the "passport" namespace

So I did the following:
sudo composer require laravel/passport
sudo php artisan migrate
sudo php artisan passport:install --force

This worked, overwriting the keys.

Then sudo npm install; results from screen pasted as below. Please let me know if the log files will help. Also of course if any of the steps I've taken prior to this is wrong, do let me know.

Thanks

=============================================
vagrant@homestead:~/code/laravue$ sudo npm install

> husky@3.1.0 install /home/vagrant/code/laravue/node_modules/husky
> node husky install

husky > Setting up git hooks
Command failed: git rev-parse --show-toplevel --git-common-dir
fatal: not a git repository (or any of the parent directories): .git
husky > Failed to install

> node-sass@4.13.1 install /home/vagrant/code/laravue/node_modules/node-sass
> node scripts/install.js

Unable to save binary /home/vagrant/code/laravue/node_modules/node-sass/vendor/linux-x64-72 : Error: EACCES: permission denied, mkdir '/home/vagrant/code/laravue/node_modules/node-sass/vendor'
at Object.mkdirSync (fs.js:840:3)
at sync (/home/vagrant/code/laravue/node_modules/mkdirp/index.js:71:13)
at Function.sync (/home/vagrant/code/laravue/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/home/vagrant/code/laravue/node_modules/node-sass/scripts/install.js:114:11)
at Object. (/home/vagrant/code/laravue/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
errno: -13,
syscall: 'mkdir',
code: 'EACCES',
path: '/home/vagrant/code/laravue/node_modules/node-sass/vendor'
}

> core-js@2.6.11 postinstall /home/vagrant/code/laravue/node_modules/babel-polyfill/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> core-js@2.6.11 postinstall /home/vagrant/code/laravue/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> ejs@2.7.4 postinstall /home/vagrant/code/laravue/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

> core-js@3.6.4 postinstall /home/vagrant/code/laravue/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> husky@3.1.0 postinstall /home/vagrant/code/laravue/node_modules/husky
> opencollective-postinstall || exit 0

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate

> node-sass@4.13.1 postinstall /home/vagrant/code/laravue/node_modules/node-sass
> node scripts/build.js

Building: /usr/bin/node /home/vagrant/code/laravue/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli '/usr/bin/node',
gyp verb cli '/home/vagrant/code/laravue/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@12.16.1 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which succeeded python2 /usr/bin/python2
gyp verb check python version /usr/bin/python2 -c "import sys; print "2.7.17 gyp verb check python version .%s.%s" % sys.version_info[:3];" returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 12.16.1
gyp verb command install [ '12.16.1' ]
gyp verb install input version string "12.16.1"
gyp verb install installing version: 12.16.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 12.16.1
gyp verb build dir attempting to create "build" dir: /home/vagrant/code/laravue/node_modules/node-sass/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/vagrant/code/laravue/node_modules/node-sass/build'
gyp ERR! System Linux 4.15.0-88-generic
gyp ERR! command "/usr/bin/node" "/home/vagrant/code/laravue/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/vagrant/code/laravue/node_modules/node-sass
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.13.1 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2020-03-29T20_00_59_472Z-debug.log

@tuandm
Copy link
Owner

tuandm commented Mar 30, 2020

Hi @c-myers1
Are you running Laravue inside vagrant? Seems you got permission issue again:

gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/vagrant/code/laravue/node_modules/node-sass/build'

I think you have started with sudo npm but the build commands done have this sudo, that causes the issue. And I don't think sudo npm is necessary for Laravel/Laravue setup.

Can you please retry with no sudo and post the full error log here?

Just note that Laravel Passport has been removed in latest version of Laravue. We use Laravue Sanctum instead.

@c-myers1
Copy link
Author

c-myers1 commented Mar 30, 2020

Hi,
True I was running this in Homestead which is Vagrant. Ok so now I'm re-doing from my Windows 10 box, using GIT BASH.

Given your move to Laravel Sanctum, and the readme.md updated 5 days ago, I skipped this step:

php artisan passport:install

I got the following in the console after running npm install:

=========================================
$ npm install

> husky@3.1.0 install C:\xampp2\htdocs\laravue\node_modules\husky
> node husky install

husky > Setting up git hooks
Command failed: git rev-parse --show-toplevel --git-common-dir
fatal: Not a git repository (or any of the parent directories): .git
husky > Failed to install

> node-sass@4.13.1 install C:\xampp2\htdocs\laravue\node_modules\node-sass
> node scripts/install.js

Cached binary found at C:\Users\user1\AppData\Roaming\npm-cache\node-sass\4.13.1\win32-x64-72_binding.node

> core-js@2.6.11 postinstall C:\xampp2\htdocs\laravue\node_modules\babel-polyfill\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> core-js@2.6.11 postinstall C:\xampp2\htdocs\laravue\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> ejs@2.7.4 postinstall C:\xampp2\htdocs\laravue\node_modules\ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

> core-js@3.6.4 postinstall C:\xampp2\htdocs\laravue\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> husky@3.1.0 postinstall C:\xampp2\htdocs\laravue\node_modules\husky
> opencollective-postinstall || exit 0

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate

> node-sass@4.13.1 postinstall C:\xampp2\htdocs\laravue\node_modules\node-sass
> node scripts/build.js

Binary found at C:\xampp2\htdocs\laravue\node_modules\node-sass\vendor\win32-x64-72\binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1590 packages from 1833 contributors and audited 24445 packages in 48.278s

34 packages are looking for funding
run npm fund for details
found 68 vulnerabilities (67 low, 1 moderate)
run npm audit fix to fix them, or npm audit for details

==================================

I then do npm run dev but nothing shows up at http://localhost:8000. npm run dev returns to the console cursor which is I dont believe is normal when its serving files. Following are the last lines I see from running npm run dev.

========================================
[webpack.Progress] 98% after emitting
[webpack.Progress] 98% after emitting SizeLimitsPlugin
DONE Compiled successfully in 31084ms1:30:24 PM

[webpack.Progress] 100%

                                                                                  Asset      Size        Chunks             Chunk Names
                                                                           /css/app.css   222 KiB       /js/app  [emitted]  /js/app
                                                                             /js/app.js  15.4 MiB       /js/app  [emitted]  /js/app
                                                                        /js/manifest.js  6.12 KiB  /js/manifest  [emitted]  /js/manifest
                                                                          /js/vendor.js  27.3 MiB    /js/vendor  [emitted]  /js/vendor
                               fonts/element-icons.ttf?bcc93066f82ea367ff47cdb616b6e608  10.8 KiB                [emitted]
                              fonts/element-icons.woff?f15c25103b6440466a7c9c3ccc560597  5.98 KiB                [emitted]

fonts/vendor/element-ui/lib/theme-chalk/element-icons.ttf?4520188144a17fb24a6af28a70dae0ce 54.6 KiB [emitted]
fonts/vendor/element-ui/lib/theme-chalk/element-icons.woff?313f7dacf2076822059d2dca26dedfc6 27.5 KiB [emitted]
images/401.gif?b7f6880afa700cd526675dc2844fd61c 160 KiB [emitted]
images/404.png?bac07f54410d774d2475a63b12e4dfbc 62.1 KiB [emitted]
images/404_cloud.png?2a6818800c5cb919d820be7aa5def5ee 2.98 KiB [emitted]
images/vendor/tui-editor/dist/tui-editor-2x.png?3e102fa77c81ad0130bd762da4c60e51 23.9 KiB [emitted]
images/vendor/tui-editor/dist/tui-editor.png?6ae4be1d76efc0c7f5dbc4bba83debf6 10.6 KiB [emitted]

================

@tuandm
Copy link
Owner

tuandm commented Mar 30, 2020

@c-myers1 Did you open http://localhost:8000 using IE? Currently Laravue doesn't support IE and we are fixing this. Can you please try with Chrome/Firefox?

@c-myers1
Copy link
Author

c-myers1 commented Mar 30, 2020

ok thanks very much, it's working now.

any reason you removed the datatables sample from this version?

@tuandm
Copy link
Owner

tuandm commented Mar 31, 2020

@tuandm tuandm closed this as completed Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants