How to install livewire-devtools under Chrome? - laravel-livewire

In the console of my Livewire/livewire 2 / laravel 7 app I got error :
login?email=admin%40mail.com&password=111111:60 Uncaught TypeError: window.livewire.devTools is not a function
at login?email=admin%40mail.com&password=111111:60
(anonymous) # login?email=admin%40mail.com&password=111111:60
livewire-turbolinks.js:31 Uncaught TypeError: Livewire.hook is not a function
I found this https://reposhub.com/javascript/misc/beyondcode-livewire-devtools.html page and tried to follow it
I uploaded and unpacked chrome.zip, which contains
serge#AtHome:~/chrome$ ls -la
total 48
drwxrwxr-x 5 serge serge 4096 Nov 24 18:23 .
drwxr-xr-x 40 serge serge 4096 Nov 24 18:22 ..
drwxrwxr-x 2 serge serge 4096 Aug 30 23:47 build
-rw-r--r-- 1 serge serge 78 Aug 30 23:36 devtools-background.html
-rw-r--r-- 1 serge serge 383 Aug 30 22:09 devtools.html
-rw-r--r-- 1 serge serge 6148 Sep 1 10:28 .DS_Store
drwxrwxr-x 2 serge serge 4096 Sep 1 15:08 icons
-rw-r--r-- 1 serge serge 1175 Sep 3 23:34 manifest.json
-rw-rw-r-- 1 serge serge 27 Nov 24 18:23 package-lock.json
drwxrwxr-x 2 serge serge 4096 Aug 30 23:36 popups
-rw-r--r-- 1 serge serge 162 Sep 1 18:10 .web-extension-id
But trying to install it I got errors:
serge#AtHome:~/chrome$ npm install
npm WARN saveError ENOENT: no such file or directory, open '/home/serge/chrome/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/serge/chrome/package.json'
npm WARN chrome No description
npm WARN chrome No repository field.
npm WARN chrome No README data
npm WARN chrome No license field.
up to date in 0.523s
found 0 vulnerabilities
serge#AtHome:~/chrome$ npm run build
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/serge/chrome/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/serge/chrome/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/serge/.npm/_logs/2020-11-24T16_23_38_605Z-debug.log
I do not see file package.json, but have file package-lock.json, which contains :
{
"lockfileVersion": 1
}
What have I to do to install it under my Google Chrome Version 85.0.4183.121 (Official Build) (64-bit) ?
MODIFIED BLOCK :
I loaded and installed package from https://github.com/beyondcode/livewire-devtools
and selected in under chrome://extensions/
but I see erros buttons red: https://prnt.sc/vqgk51
and clicking on it I see error:
Error in event handler: ReferenceError: suffix is not defined
Context
_generated_background_page.html
Stack Trace
build/background.js:1 (anonymous function)
!function(e){var n={};function o(t){if(n[t])return n[t].exports;var s=n[t]={i:t,l:!1,exports:{}};return e[t].call(s.exports,s,s.exports,o),s.l=!0,s.exports}o.m=e,o.c=n,o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="",o(o.s=659)}({659:function(e,n){const o={};let t;chrome.runtime.onConnect.addListener(e=>{let n,t;!function(e){return+e+""===e}(e.name)?(n=e.sender.tab.id,t="backend"):(n=e.name,t="devtools",function(e){chrome.tabs.executeScript(e,{file:"/build/proxy.js"},function(n){n?console.log("injected proxy to tab "+e):o[e].devtools.postMessage("proxy-fail")})}(+e.name)),o[n]||(o[n]={devtools:null,backend:null}),o[n][t]=e,o[n].devtools&&o[n].backend&&function(e,n,t){function s(n){if("log"===n.event)return console.log("tab "+e,n.payload);console.log("devtools -> backend",n),t.postMessage(n)}function c(o){if("log"===o.event)return console.log("tab "+e,o.payload);console.log("backend -> devtools",o),n.postMessage(o)}function r(){console.log("tab "+e+" disconnected."),n.onMessage.removeListener(s),t.onMessage.removeListener(c),n.disconnect(),t.disconnect(),o[e]=null}n.onMessage.addListener(s),t.onMessage.addListener(c),n.onDisconnect.addListener(r),t.onDisconnect.addListener(r),console.log("tab "+e+" connected.")}(n,o[n].devtools,o[n].backend)}),chrome.runtime.onMessage.addListener((e,n)=>{n.tab&&e.livewireDetected&&(chrome.browserAction.setIcon({tabId:n.tab.id,path:{16:"icons/1.png",48:"icons/48.png",128:"icons/128.png"}}),chrome.browserAction.setPopup({tabId:n.tab.id,popup:e.devtoolsEnabled?`popups/enabled${suffix}.html`:`popups/disabled${suffix}.html`}))}),chrome.tabs.onActivated.addListener(({tabId:e})=>{t=e}),chrome.contextMenus.onClicked.addListener((e,n)=>{chrome.runtime.sendMessage({vueContextMenu:{id:e.menuItemId}})})}});
I reopened Chrome and reloaded Kubutu.
What can be the issue and how to fix it ?
MODIFIED:
Looking at branch https://github.com/beyondcode/livewire-devtools/issues/6
I found some hints how it can be fixed:
In file package.json I added
"devDependencies": {
"eslint": "^7.9.0"
},
eslint line and run
npm install
npm run watch-poll
with success
In my project I found 3 files :
/vendor/livewire/livewire/dist/manifest.json
/public/mix-manifest.json
/public/vendor/livewire/manifest.json
but all these 3 files are autogenerated I do not know which file have I to edit as I read :
{
...
"permissions": [
"http://*/*",
"https://*/*",
+ "contextMenus"
],
...
}
contextMenus is missed in manifest.json
?
Thanks!

Related

How to solve the error while building a VueJS project?

I am using VueJS for front-end and Django on back-end. For production I moved all my VueJS compiled bundel to Static/dist in django. And I blocked the content of index.html in VueJS to base.html in django. And changed the url.py such that when localhost:8000 is called it gives base.html which gives index.html of VueJS.
When I am trying to build using npm run buid it is throwing errors as shown
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! e_cell_frontend#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the e_cell_frontend#0.1.0 build 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/2021-08-05T04_54_44_578Z-debug.log
The log file is as shown:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm#6.14.4
3 info using node#v10.19.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle e_cell_frontend#0.1.0~prebuild: e_cell_frontend#0.1.0
6 info lifecycle e_cell_frontend#0.1.0~build: e_cell_frontend#0.1.0
7 verbose lifecycle e_cell_frontend#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle e_cell_frontend#0.1.0~build: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/vagrant/VueJS/e_cell_frontend/node_modules/.bin:/home/vagrant/.vscode-server/bin/c3f126316369cd610563c75b1b1725e0679adfb3/bin:/home/vagrant/.local/bin:/home/vagrant/.vscode-server/bin/c3f126316369cd610563c75b1b1725e0679adfb3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle e_cell_frontend#0.1.0~build: CWD: /home/vagrant/VueJS/e_cell_frontend
10 silly lifecycle e_cell_frontend#0.1.0~build: Args: [ '-c', 'vue-cli-service build' ]
11 silly lifecycle e_cell_frontend#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle e_cell_frontend#0.1.0~build: Failed to exec build script
13 verbose stack Error: e_cell_frontend#0.1.0 build: `vue-cli-service build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid e_cell_frontend#0.1.0
15 verbose cwd /home/vagrant/VueJS/e_cell_frontend
16 verbose Linux 5.4.0-73-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error e_cell_frontend#0.1.0 build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the e_cell_frontend#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I tried to clear the cache, delete node_modules and reinstalling them but there is no use. Can any one help me solving this problem.
I solved the problem. The thing is you need to remember that you need to run npm run serve first to check is there any errors in the code and then build it. I had a typo and forgot execute npm run serve so I am unaware of original errors. So run npm run server if all is good. The build it.

AWS CDK -- Error: Cannot find module '#aws-cdk/cloud-assembly-schema' in Azure DevOps pipeline

Running my AWS CDK on Azure DevOps Pipeline, but getting this Cannot find module '#aws-cdk/cloud-assembly-schema' error. No idea what goes wrong at the moment.
Run cdk synth myStack
The pipeline yml:
trigger:
- none
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool#0
inputs:
versionSpec: '16.x'
displayName: "Install NodeJS"
- script: |
echo "Check version"
which node
echo "Node Version: "
sudo node -v
echo "NPM Version: "
sudo npm -v
displayName: "Node Version check"
- script: |
echo "Installing packages"
echo "Install AWS CDK"
sudo npm install -g aws-cdk
displayName: 'Installing aws cdk'
- script: |
echo "NPM INSTALL"
sudo npm install
displayName: "NPM INSTALL"
- task: AWSShellScript#1
inputs:
awsCredentials: 'azure-infra-deploy-ops'
regionName: 'ap-southeast-2'
scriptType: 'inline'
workingDirectory: '$(Build.SourcesDirectory)'
inlineScript: |
echo "Running validations"
cdk synth myStack
displayName: 'AWS CDK output'
Error output:
Error: Cannot find module '#aws-cdk/cloud-assembly-schema'
Require stack:
- /home/vsts/work/1/s/node_modules/#aws-cdk/core/lib/annotations.js
- /home/vsts/work/1/s/node_modules/#aws-cdk/core/lib/tag-aspect.js
- /home/vsts/work/1/s/node_modules/#aws-cdk/core/lib/index.js
- /home/vsts/work/1/s/bin/tandm-cdk.ts
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
at Function.Module._load (node:internal/modules/cjs/loader:774:27)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (/home/vsts/work/1/s/node_modules/#aws-cdk/core/lib/annotations.ts:1:1)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
Subprocess exited with error 1
##[error]Error: The process '/usr/bin/bash' failed with exit code 1
Checked the node_modules in the build run time, it looks all work out:
-rw-r--r-- 1 vsts docker 543 May 9 23:29 README.md
-rw-r--r-- 1 vsts docker 1409 May 9 23:29 azure-pipelines-pr.yml
-rw-r--r-- 1 vsts docker 1006 May 9 23:29 azure-pipelines.yml
drwxr-xr-x 2 vsts docker 4096 May 9 23:29 bin
-rw-r--r-- 1 vsts docker 682 May 9 23:29 cdk.json
-rw-r--r-- 1 vsts docker 130 May 9 23:29 jest.config.js
drwxr-xr-x 2 vsts docker 4096 May 9 23:29 lib
drwxr-xr-x 401 vsts docker 16384 May 9 23:29 node_modules
-rw-r--r-- 1 vsts docker 282463 May 9 23:29 package-lock.json
-rw-r--r-- 1 vsts docker 1195 May 9 23:29 package.json
drwxr-xr-x 2 vsts docker 4096 May 9 23:29 test
-rw-r--r-- 1 vsts docker 598 May 9 23:29 tsconfig.json
/home/vsts/work/1/s
/home/vsts/work/1/s/node_modules/aws-cdk/node_modules/#aws-cdk/cloud-assembly-schema
package.json
"dependencies": {
"#aws-cdk/aws-certificatemanager": "^1.102.0",
"#aws-cdk/aws-cloudfront": "^1.102.0",
"#aws-cdk/aws-cloudwatch": "^1.102.0",
"#aws-cdk/aws-ec2": "^1.102.0",
"#aws-cdk/aws-ecr": "^1.102.0",
"#aws-cdk/aws-ecs": "^1.102.0",
"#aws-cdk/aws-ecs-patterns": "^1.102.0",
"#aws-cdk/aws-elasticloadbalancingv2": "^1.102.0",
"#aws-cdk/aws-iam": "^1.102.0",
"#aws-cdk/aws-logs": "^1.102.0",
"#aws-cdk/aws-route53": "^1.102.0",
"#aws-cdk/aws-route53-targets": "^1.102.0",
"#aws-cdk/aws-s3": "^1.102.0",
"#aws-cdk/aws-s3-deployment": "^1.102.0",
"#aws-cdk/core": "1.102.0",
"dotenv": "^8.2.0",
"source-map-support": "^0.5.16"
},
"engines": {
"node": "16.x"
}
You have to install the missing package for aws-cdk before calling cdk synth myStack.
run this command under pipeline task:
npm i #aws-cdk/cloud-assembly-schema
I've found the problem at the end. In short, it's the difference of npm version between the local that generating the package-lock.json and the build agent.
I've compiled the information and written into my own blog. Feel free to have a look: Lesson learn from aws cdk azure pipeline.

Redmine plugin not found

I'm doing a installation on a Ubuntu machine (16.04 server) and I need to install the plugins for the Redmine platform (the lastest version). I installed Redmine using the official documentation: Install Redmine step by step on Ubuntu
The installation was successful but now I have to install some plugins but every time I try to install I get: plugin was not found.
Since I made everything as said in the documentation I have this folder structure:
var/www/html/redmine
-rw-r--r-- 1 root root 459 Mar 13 2016 404.html
-rw-r--r-- 1 root root 648 Mar 13 2016 500.html
-rwxr-xr-x 1 root root 473 Mar 13 2016 dispatch.fcgi
-rw-r--r-- 1 root root 7886 Mar 13 2016 favicon.ico
-rw-r--r-- 1 root root 43 Jul 13 12:07 Gemfile
-rw-r--r-- 1 root root 143 Jul 13 12:07 Gemfile.lock
drwxr-xr-x 51 root root 4096 Jul 12 16:11 help
drwxr-xr-x 4 root root 4096 Jul 12 16:12 images
drwxr-xr-x 4 root root 4096 Jul 12 16:12 javascripts
drwxr-xr-x 2 root root 4096 Jul 12 16:12 plugin_assets
drwxrwxrwx 4 root root 4096 Jul 19 17:30 plugins
lrwxrwxrwx 1 root root 25 Jul 19 18:37 public -> /usr/share/redmine/public
drwxr-xr-x 9 root root 4096 Jul 13 10:02 redmine_agile
drwxr-xr-x 3 root root 4096 Jul 12 16:12 stylesheets
drwxr-xr-x 5 root root 4096 Jul 12 18:05 themes
To install the plugins I follow this tutorial: Install plugin. I use this command: bundle install --without development test --no-deployment on /var/www/html and everything is ok. But then I need to use bundle exec rake redmine:plugins NAME=redmine_checklists RAILS_ENV=production (in the same location as the previous command) and I get plugin was not found
Things I already tried:
Use Redmine last version
update bundler
execute rake on Redmine root
update all gems
set the right permissions on the plugins folders
and nothing seems to work.
bundle exec rake redmine:plugins:migrate RAILS_ENV=production NAME="YOUR_PLUGIN_NAME" in the root_app folder

docker-compose on windows directory sync

Running the django tutorial for docker compose, but the command to init the django project is not working as expected.
$ docker-compose run web django-admin.py startproject composeexample .
[31mERROR[0m: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose run`.
In windows "interactive" mode is not supported so I modified the command to run in "detached" mode.
$ docker-compose run -d web django-admin.py startproject composeexample .
Creating network "djangotest_default" with the default driver
...
Successfully built 0fb90648c1d8
[33mWARNING[0m: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
djangotest_web_run_1
This seems to create the boxes.. but my current directory shows no new files (from the django-admin command).
$ ls
docker-compose.yml Dockerfile requirements.txt
How do I get the container output to sync with the current working directory as expected?
The fix was to uninstall Windows 10 and install a *nix system. The files then appear as per the tutorial.
~/docker/django-test $ ll
total 60
drwxr-xr-x 4096 Sep 24 00:47 ./
drwxr-xr-x 4096 Sep 24 00:40 ../
drwxr-xr-x 4096 Sep 24 00:47 composeexample/
-rw-r--r-- 209 Sep 24 00:41 docker-compose.yml
-rw-r--r-- 146 Sep 24 00:41 Dockerfile
-rwxr-xr-x 812 Sep 24 00:47 manage.py*
-rw-r--r-- 16 Sep 24 00:41 requirements.txt

Uploading code of django to github repository in ubuntu

I have this little problem regarding to upload my existing django project to github repository.
This is my working directory and here my django code stays.
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ ls -l
total 56
drwxrwxr-x 4 mjrulesamrat mjrulesamrat 4096 Aug 27 05:31 article
-rw-r--r-- 1 mjrulesamrat mjrulesamrat 34816 Aug 26 21:42 db.sqlite3
drwxrwxr-x 2 mjrulesamrat mjrulesamrat 4096 Aug 27 06:35 django_test
-rwxr-xr-x 1 mjrulesamrat mjrulesamrat 254 Aug 25 18:09 manage.py
-rw-rw-r-- 1 mjrulesamrat mjrulesamrat 0 Aug 27 06:46 README.md
drwxrwxr-x 4 mjrulesamrat mjrulesamrat 4096 Aug 27 05:35 static
drwxrwxr-x 2 mjrulesamrat mjrulesamrat 4096 Aug 27 05:33 templates
Now when i try to add or commit it says following msg.
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ git add .
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ git status
On branch master
nothing to commit, working directory clean
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ git commit -m "app_commit_no_4"
On branch master
nothing to commit, working directory clean
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$
Please help me upload code to my repository.
to upload my code to github repository, I usually create my project on github first.
clone my project to my PC with git clone https://github.com/myusername/myproject.git
copy - paste to my code to cloned project.
run git add .
run git commit -am 'this is msg'
run git push origin master
First of all I have made changes on the remote repository.
That's why it was giving me error.
So, first i have to pull the changes from the remote repository and then i have to push the changes.
These are the commands that I followed.
I learned from my sir later.
git pull remote_repo
git add .
git status
git commit -m "message"
git push -u origin master
This works good till date.