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

"node" and "npm": executable file not found in $PATH #694

Closed
ignaciomella opened this issue Apr 25, 2022 · 18 comments
Closed

"node" and "npm": executable file not found in $PATH #694

ignaciomella opened this issue Apr 25, 2022 · 18 comments
Assignees

Comments

@ignaciomella
Copy link

Description
I need to use npm and nodejs, but it seems that they are not installed.

Steps To Reproduce

  1. New fresh installation through automated one-liner
  2. exectute bin/npm --version and bin/node --version

Expected Result
No erros.

Error: Executable file not found in $PATH

@TerrorSquad
Copy link

TerrorSquad commented Apr 25, 2022

I just came here to report the same thing. The latest image doesn't have node and npm in the PATH.
The previous version works though - markoshust/magento-php:7.4-fpm-13

@magedevjosh
Copy link

magedevjosh commented Apr 25, 2022

I ran into this as well. Ended up having to bash into the container and use this link to install node/npm using method #2. Then, you'll need to update the cli commands on your local to run the command as npx instead of npm.

@dirkreitz
Copy link

obviously the new 'streamlined' php images don't have node support at all - I do not know if this is on purpose or by accident

@dirkreitz
Copy link

As I build my own php images, I still install node with the following lines:

RUN apt-get install -y gnupg
&& curl -sL https://deb.nodesource.com/setup_current.x | bash -
&& apt-get install -y nodejs
&& mkdir /var/www/.config /var/www/.npm
&& chown app:app /var/www/.config /var/www/.npm
&& npm install -g grunt-cli

Mark had the same setup, but was using an outdated version of node

@ignaciomella
Copy link
Author

The thing is... there is no reference to this strimlined image being not compatible with the custom CLI Commands.

If so, it would be nice to reference this lack of support somewhere in the README.md

@malou72
Copy link

malou72 commented Apr 26, 2022

First of all, thank you to mark and commu for this great work.

I am also stuck with this same problem.
I don't want to override the image to stay up to date.

Before the problem is fixed, are there any old versions compatible with grunt?
Ex: markoshust/magento-php:7.4-fpm-{version}

Or create a "bin/setup-grunt" script. Would you have an idea ?
When I ran the first command. I had an error :
bin/cli apt install nodejs npm

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Thanks for all,

@dirkreitz
Copy link

I would like to give Mark a chance to answer, why he dismissed the installation of node.
As far as I know, php:7.4-fpm-13 should work ...

@TuVanDev
Copy link
Contributor

TuVanDev commented May 2, 2022

I confirmed that npm and node does not available on the latest Automated Setup which has markoshust/magento-php:8.1-fpm-0

@vy-shmal
Copy link

vy-shmal commented May 4, 2022

After installing the node and npm by myself as @dirkreitz suggested, I had a problem with the source maps of the css files. For some reason it wasnt showing on the chrome .

I solve it by implementing this suggesion
magento/magento2#20952 (comment)

x3: {
        area: 'frontend',
        name: 'Grudado/x3',
        locale: 'pt_BR',
        options: {
            sourceMap: true,
            strictImports: false,
            sourceMapRootpath: '/',
            dumpLineNumbers: false, // use 'comments' instead false to output line comments for source
            ieCompat: false
        },
        files: [
            'css/styles-m',
            'css/styles-l',
            'css/email',
            'css/email-inline'
        ],
        dsl: 'less'
    },

and less.js

var lessOptions = {
    options: {
        sourceMap: true,
        strictImports: false,
        sourceMapRootpath: '/',
        sourceMapFileInline: 'true',
        dumpLineNumbers: false, // use 'comments' instead false to output line comments for source
        ieCompat: false
    },
    setup: {
        files: {
            '<%= path.css.setup %>/setup.css': '<%= path.less.setup %>/_setup.less'
        }
    },
    updater: {
        files: {
            '<%= path.css.updater %>/updater.css': '<%= path.less.setup %>/_setup.less'
        }
    },
    documentation: {
        files: {
            '<%= path.doc %>/docs.css': '<%= path.doc %>/source/docs.less'
        }
    }
};

@markshust
Copy link
Owner

Sorry for the delay in my response of this issue, just got over a big course creation bender.

I forgot to note the removal of node & npm in the latest images. If you absolutely need these, I'd recommend reverting back to the previous Docker images for the time being.

I'd like to move node/npm to their own containers. I wasn't sure if the code is dependent upon the PHP images or not, but there should be a way to make the binaries accessible within their own containers. This would provide the ability to update node/npm sources without affecting the PHP image.

I'll try to take a look at this soon, but if anyone wants to take a stab at this, let me know!

@artmouse
Copy link

Or create a "bin/setup-grunt" script. Would you have an idea ? When I ran the first command. I had an error : bin/cli apt install nodejs npm

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Thanks for all,

bin/root apt update
bin/root apt install nodejs npm
cd src
cp Gruntfile.js.sample Gruntfile.js
cp grunt-config.json.sample grunt-config.json
cp package.json.sample package.json
cd ..
bin/root npm install -g grunt-cli
bin/npm install
bin/npm update

@malou72
Copy link

malou72 commented May 12, 2022

Thanks @artmouse for your reply !

I choosed to downgrade markoshust/magento-php:7.4-fpm-13 and It works.

@drtrem86
Copy link

use
bin/rootnotty
bin/rootnotty apt install nodejs npm
standalone container

@thinkfix
Copy link

I use markoshust/magento-php:8.1-fpm-develop
node --version
v14.19.1
npm --version
6.14.16

@markshust
Copy link
Owner

I was planning on putting npm & node in their own container, but it seems there is a lot of dependencies such as cache-clean not working unless node is installed. I'll be adding them back into this main image momentarily and will rebuild these images 👍 Really sorry if this has inconvenienced anyone, but will get these packages added very soon.

@markshust markshust self-assigned this May 25, 2022
markshust added a commit that referenced this issue May 25, 2022
@markshust
Copy link
Owner

I did forget there is an open PR which could potentially add this as a separate container instead https://github.com/markshust/docker-magento/pull/699/files .... looking at this before rebuilding images.

@markshust
Copy link
Owner

@markshust
Copy link
Owner

Released in 43.0.0

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