NPM Installation Errors
I am trying to install NPM for a Node.js application. I have already registered the app using Application Manager and uploaded my package.json file to the application directory. I tried running Ensure Dependencies but got an error saying to run the following command:
cd /home/username/public_html/example.com/app && /opt/cpanel/ea-nodejs10/bin/npm install
I logged into SSH and pasted that command, but instead of installing the node modules specified in package.json I got the following:
npm WARN lifecycle npm is using /opt/cpanel/ea-nodejs10/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> puppeteer@8.0.0 install /home/username/public_html/example.com/app/node_modules/puppeteer
> node install.js
sh: node: command not found
npm WARN appname@0.0.1 No repository field.
npm WARN appname@0.0.1 No license field.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! puppeteer@8.0.0 install: `node install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the puppeteer@8.0.0 install 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! /root/.npm/_logs/2021-03-27T06_21_36_620Z-debug.log
I am not sure how to access the above log file because WHM does not have a file manager like cpanel does so I can't simply click on a folder and navigate to it.
UPDATE: This problem seems isolated to Puppetter. When I try to run npm i puppeteer after installing all other modules I get the error.
-
Here is someone else with the problem who doesn't appear to have solved it as far as I can tell One person on that thread said the problem is from puppeteer not downloading chromium. That would make sense because I was told by a shared host whose service I couldn't use that root access was needed to use puppeteer. I have root access, so I am not sure what the problem is. Do I have to install Chromium somehow on my own before installing Puppeteer? 0 -
I found a solution and Puppeteer is installed. I had to create a file called .npmrc in the application root and add a line that said scripts-prepend-node-path=true 0 -
I'm glad you were able to get that working! 0 -
If anybody would still have issues with installing Puppeteer, it's because Puppeteer tries to run node from the command line but it cannot find it, since the path is not set. You need to go to the root directory of your user and there you will find a file called '.bash_profile'. Edit this file and add this to the bottom of it (change the version and the path to your current installed node version and path): VERSION=v16.19.1 DISTRO=linux-x64 export PATH=/opt/cpanel/ea-nodejs16/bin:$PATH and then run this command: source ~/.bash_profile Afterwards it should install and run fine. 0 -
If anybody would still have issues with installing Puppeteer, it's because Puppeteer tries to run node from the command line but it cannot find it, since the path is not set. You need to go to the root directory of your user and there you will find a file called '.bash_profile'...
How to access the root directory? I cannot access this file from my cPanel0 -
How to access the root directory? I cannot access this file from my cPanel
ANSWER: via WHM worked for me0
Please sign in to leave a comment.
Comments
6 comments