Description
Do you want to request a feature or report a bug?
bug
What is the current behavior?
The NodeInstaller.java fails to update an existing NodeJS version (Node.exe) using the renameTo function. The task fails. If I delete the node folder manually before running the task, the NodeJS executable is installed properly.
If the current behavior is a bug, please provide the steps to reproduce.
[INFO] --- frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) @ PROJECT ---
[INFO] Node v6.12.0 was installed, but we need version v8.9.1
[INFO] Installing node version v8.9.1
[INFO] Downloading https://CORPORATE-PROXY/nodejs/v8.9.1/node-v8.9.1-win-x64.zip to C:\m2_repo\com\github\eirslett\node\8.9.1\node-8.9.1-win-x64.zip
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking C:\m2_repo\com\github\eirslett\node\8.9.1\node-8.9.1-win-x64.zip into C:\PATH\TO\PROJECT\node\tmp
[INFO] Copying node binary from C:\PATH\TO\PROJECT\node\tmp\node-v8.9.1-win-x64\node.exe to C:\PATH\TO\PROJECT\node\node.exe
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:25 min
[INFO] Finished at: 2017-11-17T10:01:40+01:00
[INFO] Final Memory: 66M/495M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) on project PROJECT: Could not install Node: Was not allowed to rename C:\PATH\TO\PROJECT\node\tmp\node-v8.9.1-win-x64\node.exe to C:\PATH\TO\PROJECT\node\node.exe -> [Help 1]
What is the expected behavior?
Either one of:
- renameTo works as expected
- or: Try to delete any existing executable file in advance, before copying over a new version instead of using renameTo
Please mention your frontend-maven-plugin and operating system version.
Plugin: 1.4 (haven't seen any relevant changes in the commits of 1.5 and 1.6)
OS: Windows 7 x64
Best Regards,
Jan
Activity
rejas commentedon Dec 1, 2017
Can confirm this happens on 1.6 too.
irbian commentedon Jan 9, 2018
1.1, 1.2 and 1.3 gave me a nullpointerexception like this:
Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:install-node-and-npm (install node and npm) on project PROJECT: Execution install node and npm of goal com.github.eirslett:frontend-maven-plugin:1.3:install-node-and-npm failed. NullPointerException
1.4, 1.6 and 1.6 gave me the was not allowed to rename
Is this related to #147 ?
gvespucci commentedon Jan 30, 2018
This happens to me, too.
Maven: 3.5.0
Plugin: 1.6
OS: Windows 10 Enterprise x64
Best Regards,
Giorgio
deepakab03 commentedon May 10, 2018
I encountered this Bug as well. For us the build was running on a windows Jenkins CI server with Maven 3.x and Plugin 1.6, and I think Windows 10 Enterprise x64..
The issue appears to be because of the existing workspace containing the previous node version with the folder name as ..blah..\node. So the new version that is downloaded cannot be renamed to this existing folder.
Workaround - For Jenkins - Specify (check) the Delete workspace before Build option for 1 build cycle, so that the workspace is deleted and the plugin downloads the Node version and renames it without any issue since no existing node folder is present. After build success, don't forget to un-check this option for faster builds. Locally - simply delete the node folder.
I am giving some steps to reproduce the same, in case this wasn't clear from earlier posts:
How to reproduce the same
Error:
erikyuzwa commentedon May 23, 2018
TL;DR - use Node
8.9.4
can reproduce this issue - have tried via the Windows cmd.exe and git bash console windows, both using a normal user window and one created via "run as administrator". Same error condition(s) using the following versions of NodeJs.
10.3.0
- error8.11.2
- error8.11.1
- error8.10.0
- error8.9.4
- successDiabolusExMachina commentedon Jul 17, 2018
any news on this? This should be easy to fix and is very annoying
AlexanderEerenberg commentedon Jul 19, 2018
Same here =(
eirslett commentedon Jul 20, 2018
I don't have access to a Windows box. If anybody fixes it and creates a PR, I can merge and release it.
ghost commentedon Aug 2, 2018
this bug happened to me when node was already installed on the project but I've updraged the node version on the pom.xml. To fix it I've deleted the "node" folder and restart "maven install".
erikyuzwa commentedon Aug 3, 2018
@vacolane - this didn't work for me.
I believe I tracked down the specific code around the issue -
NodeInstaller.java
around L221Figuring out how to build + test this locally, but there must be a workaround to using
renameTo
in this way.DiabolusExMachina commentedon Nov 13, 2018
@eirslett this should be very easy to fix. Just delete the file before you rename it.
Just add this line to delte the node exe before you copy it.
Zardoz89 commentedon Jan 25, 2019
Any notices about this ? No body did a PR to fix this ?
Fix eirslett#670: Use Files.move instead of File.rename to move files…
Fix eirslett#670: Use Files.move instead of File.rename to move files…
2 remaining items