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
NodeInstaller fails at renameTo Node Binary with existing NodeJS version (Windows) #670
Comments
Can confirm this happens on 1.6 too. |
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 ? |
This happens to me, too. Best Regards, |
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. I am giving some steps to reproduce the same, in case this wasn't clear from earlier posts:
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v8.11.1</nodeVersion>
<workingDirectory>${basedir}</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Error:
|
TL;DR - use Node 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.
|
any news on this? This should be easy to fix and is very annoying |
Same here =( |
I don't have access to a Windows box. If anybody fixes it and creates a PR, I can merge and release it. |
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". |
@vacolane - this didn't work for me. I believe I tracked down the specific code around the issue -
Figuring out how to build + test this locally, but there must be a workaround to using |
@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. Files.deleteIfExists(file.toPath()); //path to existing node exe |
Any notices about this ? No body did a PR to fix this ? |
… because File.rename does not support overwriting existing files on windows
… because File.rename does not support overwriting existing files on windows
Fix #670: Use Files.move instead of File.rename to move files
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:
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
The text was updated successfully, but these errors were encountered: