I’ve opened a ticket on Github, but it will be fixed in some time because contributors have a lot to do.
From what I saw, it is because you’re using a old npm version, and you should update it. New versions don’t provoke blocking issue for this.
@josephh i am still getting the same error with npm install. There is some problem with the installation of puppeteer. Even if i simply do npm i puppeteer , installation fails with the same error message:
@Pr0tonX i am already using the latest stable versions of node and npm.
I think the issue you mentioned is different from this issue. The issue you mentioned occurs while running grunt. But i am still stuck at installing dependencies
Its opening node shell instead of downloading chromium
maybe because of this whenever i do npm ci or npm install it works fine until it executes sh -c node install.js and as soon as it starts executing sh -c node install.js it gets stuck for 2-3 minutes and then maybe times out and throws error.
However If i type node install.js inside the puppeteer folder then its downloading chromium
So the problem is sh -c node install.js opens a node shell instead of downloading chromium.
If i am not wrong should i open an issue on their github repo or can there be any other possible workaround through which i will be able to set up p5.js ?
Yes you are right, it seems that node doesn’t understand the last parameter but it’s strange because the man sh page tells :
-c Read commands from the command_string operand instead of from the
standard input. Special parameter 0 will be set from the
command_name operand and the positional parameters ($1, $2, etc.)
set from the remaining argument operands.
This is the same with :
$ sh -c python3 test.py
Python 3.8.6 (default, Sep 25 2020, 09:36:53)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
even if test.py doesn’t exist.
I think that Grunt is calling the sh -c node install.js command because in a test project I can easily install puppeteer without problem :
mkdir test && cd test
npm init -y
npm install puppeteer
I did not understand this part
I looked into gruntfile.js but i was not able to find anything related to sh -c node install.js
Also in the file .../node_modules/puppeteer/install.js it is mentioned that:
By default, the puppeteer package runs this script during the installation
process unless one of the env flags is provided.
So I think puppeteer is calling sh -c node install.js and issue should be posted on puppeteer’s repo. I may be wrong because I dont know much about grunt or what exactly happens internally when we execute npm install package_name So please cocrrect me if i am wrong.
I am not sure because as I said you can create a test project and install puppeteer with npm install puppeteer and it works fine.
I tried doing npm ci with the latest commit on the main branch (Fri Feb 12 14:25:50 2021, make sure to do git pull) and there’s no errors :
~/p5.js $ npm ci
added 1889 packages, and audited 1890 packages in 53s
33 vulnerabilities (13 low, 10 moderate, 10 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues possible (including breaking changes), run:
npm audit fix --force
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
So make sure to pull the latest commit and if it doesn’t work then there’s an issue with your configuration or something.
I also noticed that you installed Node as a snap package, maybe it’s causing issues.
Grunt is a task runner for JS but I don’t think it is involved here ; we even don’t reach the step where you run npm run gruntt.
The puppeteer package does not suffer any troubles in itself indeed because you can run it easily alone.
But I guess that sh - c node install.js is simply the “translation” of the running task of npm.
The weird thing is that the command isn’t a string, so of course it opens a Node terminal session, and do not install anything (you can try sh -c 'node install.js' to see the normal expected behavior).
However, the point mentioned by @josephh is interesting : if you downloaded npm & node via snap, you might try to download the binary from the official website of Node.js, and then try to reinstall the P5 project.
I didn’t find anything like this in my files, cloned from the latest release of the p5 repo (1.1.9 so far), which version do you have ? (you can find it in the package.json)
Okay I will install nodejs using apt or from nodejs site and then will post the findings here.
Its not in cloned files. When i run npm ci or lets say just npm i puppeteer then first puppeteer package files are downloaded inside node_modules/puppeteer , one of those files is install.js (which installs a recent version of chromium ). If you open this install.js file you will see it has the code to download browser and also in the comments its mentioned that this (install.js) script is run by puppeteer itself.
But as pointed by you guys command sh -c node install.js is not working as expected irrespective of whether puppeteer calls it or p5.
So i will check if this strange behaviour is due to snap installation of nodejs.
I removed nodejs from snap store and then installed nodejs again from node’s distributions page in github. Now npm ci is working properly.
Thank a lot @josephh and @Pr0tonX for helping with this issue