I have been using Browsershot to retrieve some images from my website without any issues for months, but recently (past 1-2 weeks), the request has been timing out. Looking further into it, I've found that it has been consuming a large amount of cpu power while trying to execute the command.
As far as I can tell, this constant CPU drain will continue until I restart the server. I also only requested for one image to be made in this example, yet there are three processes of chrome. I'm not sure if that's irregular.
In order to make sure that it wasn't something on my website or possibly a setting causing this, I used a simple function call.
Browsershot::url("https://example.com")
->setScreenshotType('png')
->save(Storage::path("overview_images/test.png"));
Unfortunately the problem still occurs.
I am using a Laravel provisioned Forge server, so I used the installation recommended by the Github page. Like I said, it had been working fine up until a couple of weeks ago. No changes were made to Browsershot around that time that would cause something like this. I have tried following the steps to install again, but it still happens.
Any help is greatly appreciated!
Edit 1:
After looking into it further, I've figured out that the problem lies within Puppeteer, not Browsershot. I tried implementing the example.js provided by Google, and I ran into the exact same problem.
Edit 2:
Somehow I was able to get it fixed. I can't tell exactly what did it, but I may be able to offer some help to anyone else who may find this question.
Running ndb example.js, I got the message
Downloading Chromium r624492...
ERROR: Failed to download Chromium r624492!
Error: EACCES: permission denied
Even though I had installed puppeteer (multiple times), I guess it was continuously trying and failing to download Chromium. I assume this is why the CPU usage was so high and never stopped until the server was restarted.
With that said, I didn't change anything specifically that made it suddenly start working. If it helps at all, this was a series of commands that I used when it suddenly started to work.
> node example.js // Didn't Work. Would be in continuous command with high CPU usage until cancelled
> sudo npm install -g ndb
> ndb example.js // This is when I received the message about downloading Chomium
> node example.js // It worked ?
Still don't know the exact reason for why this is happening, so I'll leave this as an open question if anybody can figure that out.
Edit 3:
It broke again.
I think I've finally figured it out.
From Browsershot's Github page, it recommends executing these commands to install puppeteer.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev libxshmfence-dev
sudo npm install --global --unsafe-perm puppeteer
sudo chmod -R o+rx /usr/lib/node_modules/puppeteer/.local-chromium
The npm install fails installing the chromium part of puppeteer despite the --unsafe-perm.
Changing --unsafe-perm to --unsafe-perm=true seems to have fixed it.
So changing the command to the following should fix the install and actually download Chromium.
sudo npm install -g puppeteer --unsafe-perm=true
Related
I just got my M1 and trying to get my head around cypress so basically following basic steps in order to open cypress and check if its there and its possible to run it.
mkdir cypress_test
npm init -i
npm install --save-dev cypress
npx cypress open (thats where issues appears)
Cypress failed to start.
This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies
Please refer to the error below for more details.
Command failed with Unknown system error -86: /Users/test/Library/Caches/Cypress/9.6.1/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=610
spawn Unknown system error -86
I have attempted trying to install cypress with force with the following command -
npx cypress install --force however sadly it did not help and same error appears
I also saw somebody manage to fix it by changing Mac with M1 chip to OS ver. 11.5.x (BigSur) however is not something i would like to do.
Any help is appreciated
Thanks.
The only way that i managed to sort this out is by install Rosetta 2 that transitions between Intel and Apple processors.
softwareupdate --install-rosetta --agree-to-license
https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2/
The Problem
At the moment, Cypress cannot be compiled under the ARM-based architecture of new Mac computers and Continuous Integration (CI) providers do not currently offer M1 instances. For these reasons, Cypress is not currently released for the ARM-based architectures and will require Intel emulation for some time.
Therefore, running npm install cypress will install the Intel-based package until these challenges are resolved. See here for workaround
See here for more info https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2/
I’m having this issue with npm where I cannot install the packages in my package.json on my home network. I tried countless “fixes” (including modifying the registry to http instead of https, modifying the proxy and https-proxy, using unsafe-perm, installing the packages individually, etc.) but none of them seem to work. I decided to try installing them while connected to my phone’s LTE hotspot and miraculously it worked normally. Now my next issue is, what could be causing this?
When I install on my network, it starts to slow down and then completely stops and hangs (on a random package). After a few tries, I was able to install yarn, and could install my dependencies with it.
Extra info:
I tried this on multiple node/npm versions but still hangs
Verbose install on npm doesn’t give much information, but usually hangs here [.....] \ extract:rxjs: sill extract rxjs#6.3.3 extracted to /home/abbas/git/abbas-yadollahi/node_modules/.staging/rxjs-36adb757 160099ms
My network is fine as far as I know (50/10 up/down and I’m on LAN)
After trying to use the Windows Powershell (as an admin), the command prompt (as an admin) and the bash CMD; I repeatedly get the following error after trying an npm install command:
npm install npm#latest -g
is the attempted command and...
[...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx
where the 'x's represent different letter and number combinations at each attempt, is the message. I am aware that this should be the first step in the installation of a package but it remains on this message for a long time and will not change.
I am trying to use the JavaScript React library, more specifically the 'create-react-app'. The npm install -g create-react-app command is also causing the error.
npm version: 6.5.0
npx version: 10.2.0
node version: 10.15.0
A solution would be greatly appreciated.
https://docs.npmjs.com/try-the-latest-stable-version-of-npm In this link there is the documentation for updating npm version for windows with a link to a tool developed by Microsoft to update npm (https://github.com/felixrieseberg/npm-windows-upgrade)
I found the solution:
As my device username has both my first and last names, with a space in between, npm was reaching errors because of this. So the solution was to uninstall node from the default location and reinstall it in a folder on my C:\ drive, where there were no files in the directory that have spaces in the names. I then changed the cache location into this same C:\ drive folder, and the problem was solved.
npm config set cache C:\NODEJS\npm-cache
(these folders must be created before you can set the config directory to these.)
For me, I ended up having to:
Uninstall Node.js
Remove the folder "nodejs" completely from C:\Program Files (or
wherever you decided to install node)
Reinstall Node.js
After that, I did not encounter [...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx anymore.
I'm not quite sure what the issue was but all suggestions I found on stack did not solve this problem for me. I hope this helps someone.
Check if you are connected to any other VPN or proxy setting. If so try to disable it or disconnect from it and then execute the npm command. It worked for me. In my case, I was using the organization laptop and was connected to external vpn network, so i disabled the vpn and tried the command and it worked.
In our case the hard disc of the nexus server (repository server) was just full. Maybe someone helps this. Before looking into other more complicated options.
for my case i uninstalled the reinstelled it and used powershell insted of cmd and it worked like a charm
First run these commands.
npm config rm proxy
npm config rm https-proxy
then run this.
npm config set registry https://registry.npmjs.org/
check if the internet is connected
and try to run the npm command which was giving the error.
I use ARM board with embedded Linux on it, but it is very limited. Somehow I managed to install node.js and npm. The idea is to send data via CAN bus on button click event from the web page. I have found only one module called "socketcan", but I cannot install it due to following lines:
npm install -g node-gyp
node-gyp configure && node-gyp build
My board fails to execute the first line, that means I can't use the only found CAN tool for node.js.
Is there any other possibility to read and write messages on CAN bus from node.js?
Socketcan doesn't work on the lattest Nodejs. I've got the same problem. Just install a Node.js version 0.10.x. For the arm7 you can get it from this page :
Conor O'Neills Page: http://conoroneill.net/
Thanks to Conor O'Neill you can download it on his Page and install socketcan without getting any errors. At the moment, I am struggeling how socketcan works in express-generate. So if someone has clue. I would appreciate it.
I am currently trying to download node.js. I have downloaded everything and am now at the part where I enter the console commands.
What I am entering:
cd node
./configure
make
after entering ./configure, i get this error
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer director /Library/Developer/CommandLineTools' is a command line tools instance`
I'm not sure what this means. After entering make, i then get this repeated in a infinite loop in the console
http://pastebin.com/YrDs2Afw
in general it's a good rule of thumb to provide a bit information about what you already tried and on what system you are - especially when you are having issues with installing something.
I'll just assume, that you're working on a Mac.
I would recommend to download and install XCode as Quentin already recommended.
You can find it in the AppStore.
Once that done, make sure to install the "Command Line Tools" within XCode.
Now you have several options:
- Install Homebrew and install NodeJS from there (google Homebrew if you don't know what it is)
- Download and execute the Node v0.10.26.pkg (current version as of writing this), which will take care of the installation for you.
Hope this helps