I am trying to setup a laravel project in my windows setup via WSL and i am using WSL. now the issue is, when i do npm install i am getting the following error and i have tried different type of solutions but nothing is working. Any quick help would appriciable
please let me know if any additional detail required to solve this. i will provide the same
current version on my WSL node - 21 npm - 10 nvm - 0.39.0
Here is the docker file also
FROM php:7.2-apache
RUN sed -i 's/stable/updates/stable-security/updates/' /etc/apt/sources.list RUN apt-get update --fix-missing
RUN mkdir -p /usr/share/man/man1 RUN mkdir -p /usr/share/pdftk
RUN apt-get update && apt-get install -y make RUN apt-get install -y openjdk-11-jre RUN apt-get install -y libmagickwand-dev RUN apt-get install -y git RUN apt-get install -y curl RUN apt-get install -y libssl-dev RUN apt-get install -y libmcrypt-dev RUN apt-get install -y libgmp-dev RUN apt-get install -y libtidy-dev RUN apt-get install -y libpspell-dev RUN apt-get install -y libcurl4-gnutls-dev RUN apt-get install -y libldap2-dev RUN apt-get install -y libc-client-dev RUN apt-get install -y libkrb5-dev RUN apt-get install -y librecode-dev RUN apt-get install -y libsnmp-dev RUN apt-get install -y libenchant-dev RUN apt-get install -y make RUN apt-get install -y python2.7 RUN apt-get install -y build-essential RUN rm -r /var/lib/apt/lists/*
COPY ./pdftk/pdftk.jar /usr/share/pdftk/ COPY ./pdftk/commons-lang3.jar /usr/share/java/ COPY ./pdftk/bcprov-1.58.jar /usr/share/java/
COPY ./pdftk/pdftk /usr/bin RUN chmod +x /usr/bin/pdftk
RUN apt-get clean
RUN docker-php-ext-configure gmp RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
RUN docker-php-ext-install gmp snmp soap gd enchant recode curl tidy
opcache pspell xmlrpc ldap bz2 imap dba intl xml mbstring zip pdo_mysql
gmp gd bcmath ctype json tokenizer exif mysqli calendar
RUN curl --silent --show-error https://getcomposer.org/installer |
php -- --install-dir=/usr/local/bin --filename=composer
RUN pecl install imagick mongodb
RUN echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini &&
echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongodb.ini
ENV APACHE_DOCUMENT_ROOT /var/www/html/public RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/.conf RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/.conf
RUN a2enmod rewrite
ENV NVM_DIR /root/.nvm
ENV NODE_VERSION 8.17.0
RUN mkdir $HOME/.nvm &&
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash &&
chmod +x $HOME/.nvm/nvm.sh &&
. $HOME/.nvm/nvm.sh &&
nvm install --latest-npm "$NODE_VERSION" &&
nvm alias default "$NODE_VERSION" &&
nvm use default &&
DEFAULT_NODE_VERSION=$(nvm version default) &&
ln -sf /root/.nvm/versions/node/$DEFAULT_NODE_VERSION/bin/node /usr/bin/nodejs &&
ln -sf /root/.nvm/versions/node/$DEFAULT_NODE_VERSION/bin/node /usr/bin/node &&
ln -sf /root/.nvm/versions/node/$DEFAULT_NODE_VERSION/bin/npm /usr/bin/npm
RUN npm install gulp -g
RUN pecl install xdebug-2.9.8
&& docker-php-ext-enable xdebug

Well, the build is failing because your container doesn't have
python2. This suggests to me that you are trying to build an older version of node-sass. If there is not a good reason for that, my first suggestion is that you build at least a newer version, if not the latest.Then, I found that I was able to build node-sass with the following dependencies on alpine:
This is accomplished on alpine with
apk add --no-cache python3 make g++Other package managers will be different.
Without seeing your Dockerfile, that's about all I can give you. If you absolutely must use this version of node-sass, you will need to use an older base container that will allow you to install python2, and this will mean an older version of node as well most likely. Finally, I recommend you use
yarninstead of NPM. I find it to be easier to read the error output, and friendlier in general.Edit: Here is a working Dockerfile.
Of course this container is fairly useless, but it shows that the build works with these dependencies.
My advice holds for your php version as well - unless you have a good reason to run 7.2, you should update to 8.0 (minimum non-EOL version) or 8.2.