Hi,
Everything was working well until mid-March (around the 16th or 17th). I would compile using the gulp compile command on my production server before handing things over to Nginx:
... # Load environment variables from the env file COPY $ENV_FILE .env RUN chmod +r .env # Build the client code using gulp RUN gulp compile --verbose # Use Nginx as the base image for serving the built files # FROM nginx:stable FROM openresty/openresty ...
However, this error started appearing:
[08:22:49] Using gulpfile /opt/metronic_html_v8.2.3_demo39/tools/gulpfile.js
[08:22:49] Starting 'compile'...
[08:22:49] Starting 'cleanTask'...
[08:22:49] Finished 'cleanTask' after 91 ms
[08:22:49] Starting 'buildBundleTask'...
[08:22:50] Finished 'buildBundleTask' after 472 ms
[08:22:50] Finished 'compile' after 592 ms
/root/.nvm/versions/node/v16.20.2/lib/node_modules/gulp/node_modules/streamx/index.js:255
if (this.pipeTo !== null) throw new Error('Can only pipe to one destination')
^
Error: Can only pipe to one destination
at ReadableState.pipe (/root/.nvm/versions/node/v16.20.2/lib/node_modules/gulp/node_modules/streamx/index.js:255:37)
at Transform.pipe (/root/.nvm/versions/node/v16.20.2/lib/node_modules/gulp/node_modules/streamx/index.js:696:25)
at add (/opt/metronic_html_v8.2.3_demo39/tools/node_modules/merge-stream/index.js:29:12)
at Array.forEach ()
at add (/opt/metronic_html_v8.2.3_demo39/tools/node_modules/merge-stream/index.js:22:14)
at Array.forEach ()
at module.exports (/opt/metronic_html_v8.2.3_demo39/tools/node_modules/merge-stream/index.js:16:41)
at buildBundleTask (file:///opt/metronic_html_v8.2.3_demo39/tools/gulp/compile.js:174:12)
at bound (node:domain:433:15)
at runBound (node:domain:444:12)
Initially, I thought it was something I had changed, but it seems to be something else. As you can see in the above code, I tried the same gulp compile with the original code, and it's the same error. This only started appearing in mid-March 2024. It seems a library has changed somewhere, which has caused this issue.
I've tried different versions of node/npm: 16.20.2, 20.13.1, 21.3.0, and the same error occurs.
OS: Ubuntu 23.10
Strangely enough, "gulp compile" works on my local Windows instance.
Thank you for the help in advance.
Hi
We appreciate your feedback and will look into this bug on Metronic.
Thanks for your patience and for helping improve the product!
I'm glad to hear! It's possible that a recent change in one of your npm dependencies caused the problem.
If you need any further assistance, feel free to ask!
Thanks, @Faizal. The bug is still in your code, though, and it's worth looking into at some point. As mentioned above, I tested it on raw Metronic v8.2.3 and v8.2.5, and the bug is reproducible.
OK, I've switched to compiling with Yarn and it's working again:
# Remove any old instances of Yarn RUN rm -f /usr/local/bin/yarnpkg RUN rm -f /usr/local/bin/yarn # Install Yarn globally RUN npm install --global yarn # Install Gulp CLI and Webpack CLI globally RUN npm install -g gulp-cli # Install project dependencies located in the tools directory # RUN npm install # Link global gulp to local gulp # RUN npm link gulp # Install project dependencies located in the tools directory RUN yarn # Change working directory WORKDIR /usr/src/app # Copy the client code COPY ./qm-client . # Accept an ENV_FILE build argument ARG ENV_FILE # Change working directory to tools to install dependencies WORKDIR /usr/src/app/tools # Load environment variables from the env file COPY $ENV_FILE .env RUN chmod +r .env # Build the client code using gulp RUN gulp
Don't ask me why it worked before with npm install but it did and then stopped working. Now with yarn it compiles and deploys :) .