Closed shekvl closed 5 years ago
digging deeper revealed the following:
1) frontend-maven-plugin expects node to be installed under project-name/node and npm - under project-name/node/node_modules/npm (with a binary under its bin subdirectory), it does not understand that e.g npm was installed via npm (as in this case its binary goes to project-name/node_modules/.bin)
2) it can extract node.exe to its necessary location, and subsequently can find it there and skip further install attempts
3) due to the above error, it cannot unpack npm-6.9.0.tar.gz from the maven repository to its necessary location, so it subsequently cannot find npm there and attempts to install it on every run
4) npm-6.9.0.tar.gz contains npm installation under package
, and not npm
(i.e. it contains package/bin, package/lib etc, not npm/bin, npm/lib), so in any case it cannot be extracted properly from there without additional effort. I tried to create my own version of npm-6.9.0.tar.gz with npm/{lib,bin,...} inside and put it into the place in .m2\repository to check if the unpacking error is due to this problem, but it did not make a difference.
So I was able to go past this error by creating local node by hand i.e. by:
package
from npm-6.9.0.tar.gz there creating npm/bin, npm/lib etcAfter that frontend-maven-plugin was able to find the local node and npm and proceed further:
[INFO] --- frontend-maven-plugin:1.7.5:install-node-and-npm (install node and npm) @ catalogue --- [INFO] Node v10.15.3 is already installed. [INFO] NPM 6.9.0 is already installed. [INFO] [INFO] --- frontend-maven-plugin:1.7.5:npm (npm install) @ catalogue --- [INFO] Running 'npm install' in c:\projects\catalog-v3-2a
Still, it is definitely not the right way of dealing with this.
It looks like an environment problem with your machine, and not related to the generated code, provided by JHipster. Can you test our Devbox: https://github.com/jhipster/jhipster-devbox ?
I tested this on two different computers, both running Windows, with exactly the same result. One of them had a freshly installed system, starting from OS (i.e. nothing except things necessary to run jhipster). I will definitely try Devbox and report the results.
I installed Windows 10, in a VM and tested your config. Everything works fine. I don't have problem to download node and npm locally, so it definitely comes from your installation:
~/.m2/repository/com/eirslett/
folder, it contains local node
and npm
I'm closing this, as I can't reproduce. See my screenshot.
This issue occurs on my machine, running windows 10. I have deleted the folder C:\Users\fts00193.m2\repository\com\github\eirslett, and re-run mvnw, the error still occurs.
I already have existing npm and node version installed globally as shown below:
I use JHipster 6.0.0 and generate the sample application using https://start.jhipster.tech, extract the zip file into C:\Projects folder and execute mvnw.
Need to re-open this issue.
digging deeper revealed the following:
- frontend-maven-plugin expects node to be installed under project-name/node and npm - under project-name/node/node_modules/npm (with a binary under its bin subdirectory), it does not understand that e.g npm was installed via npm (as in this case its binary goes to project-name/node_modules/.bin)
- it can extract node.exe to its necessary location, and subsequently can find it there and skip further install attempts
- due to the above error, it cannot unpack npm-6.9.0.tar.gz from the maven repository to its necessary location, so it subsequently cannot find npm there and attempts to install it on every run
- npm-6.9.0.tar.gz contains npm installation under
package
, and notnpm
(i.e. it contains package/bin, package/lib etc, not npm/bin, npm/lib), so in any case it cannot be extracted properly from there without additional effort. I tried to create my own version of npm-6.9.0.tar.gz with npm/{lib,bin,...} inside and put it into the place in .m2\repository to check if the unpacking error is due to this problem, but it did not make a difference.So I was able to go past this error by creating local node by hand i.e. by:
- making sure node.exe is in project-name/node (in my case, it was put there by previous failed runs of install-node-and-npm goal)
- creating project-name/node/node_modules/npm
- extracting sub-directories of
package
from npm-6.9.0.tar.gz there creating npm/bin, npm/lib etcAfter that frontend-maven-plugin was able to find the local node and npm and proceed further:
[INFO] --- frontend-maven-plugin:1.7.5:install-node-and-npm (install node and npm) @ catalogue --- [INFO] Node v10.15.3 is already installed. [INFO] NPM 6.9.0 is already installed. [INFO] [INFO] --- frontend-maven-plugin:1.7.5:npm (npm install) @ catalogue --- [INFO] Running 'npm install' in c:\projects\catalog-v3-2a
Still, it is definitely not the right way of dealing with this.
This manual extraction solve the issue. jhipster should be fixed to ensure smooth project build.
@fortisstar-test : as you can see in my previous comment, I installed a VM with Windows 10 and didn't manage to reproduce. Without additionnal information, it's impossible to help you. As I can't reproduce with Linux, VM with Windows10, it comes from your environment and your installation. You can have a look directly to the project frontend-maven-plugin too
Not sure we can do something on our side as it is managed by frontend-maven-plugin
Could you try our DevBox: https://github.com/jhipster/jhipster-devbox ?
Had the same issue & solved it quickly running it all in intellij IDEA Ultimate (as opposed to command line)
Hi,
I have the same problem - yesterday I've create a new applicaiton with jhipster v. 6.4.1 on Windows 10. I guess I've found where is the problem. It is due to plugin: frontend-maven-plugin.version in version 1.8.0 and previous. I've just debugged such a plugin and I found the problem is in the DefaultArchiveExtractor.extract method in the plugin. Here is an output from plugin with some logs that I've added: [INFO] Node v10.16.3 is already installed. [INFO] Installing npm version 6.11.3 [INFO] Unpacking C:\Users\daniels.m2\repository\com\github\eirslett\npm\6.11.3\npm-6.11.3.tar.gz into c:\daniels\sources\frontend-maven-plugin-master\example-project\node\node_modules [INFO] ====> tarEntry.getName(): package/node_modules/define-properties/.editorconfig [INFO] ====> canonicalDestinationDirectory: C:\daniels\sources\frontend-maven-plugin-master\example-project\node\node_modules [INFO] ====> destinationDirectory: c:\daniels\sources\frontend-maven-plugin-master\example-project\node\node_modules [INFO] ====> destPath.getCanonicalPath(): C:\daniels\sources\frontend-maven-plugin-master\example-project\node\node_modules\package\node_modules\define-properties.editorconfig
The problem is that plugin is trying to compare: if (!destPath.getCanonicalPath().startsWith(destinationDirectory)) and if it does not much then that error is showed.
Here: path destPath.getCanonicalPath() starts with: C: but path: destinationDirectory starts with: c:
Anyway it looks like that the problem has been already fixed in the last SNAPSHOT - please see: https://github.com/eirslett/frontend-maven-plugin/commit/6175368cca93620bad45260152391b360d0751db
but there is no new released version of that plugin.
One of the option to fix it is:
copy a files extracted from .m2\repository\com\github\eirslett\npm\6.11.3\npm-6.11.3.tar.gz\package to
Download a latest version of the frontend-maven-plugin. Run: mvn clean install and the just use this version (SNAPSHOT) in the jhipster pom.xml file like follows:
Overview of the issue
While running mvnw, the following error is thrown while installing frontend-maven-plugin. I tried installing npm 6.9.0 first, but it did not make a difference: the installer still attempts to download and unpack it, leading to error. The system is quite clean: java, maven, and node were installed there for the first time prior to installing jhipster.
[INFO] --- properties-maven-plugin:1.0.0:read-project-properties (default) @ catalogue --- [INFO] [INFO] --- frontend-maven-plugin:1.7.5:install-node-and-npm (install node and npm) @ catalogue --- [INFO] Node v10.15.3 is already installed. [INFO] Installing npm version 6.9.0 [INFO] Unpacking C:\Users\vladimir.m2\repository\com\github\eirslett\npm\6.9.0\npm-6.9.0.tar.gz into c:\projects\catalog-v3-2a\node\node_modules [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.533 s [INFO] Finished at: 2019-04-09T14:02:52+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.7.5:install-node-and-npm (install node and npm) on project catalogue: Could not extract the npm archive: Could not extract archive: 'C:\Users\vladimir.m2\repository\com\github\eirslett\npm\6.9.0\npm-6.9.0.tar.gz': Expanding package/package.json would create file outside of c:\projects\catalog-v3-2a\node\node_modules -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Motivation for or Use Case
I cannot go past this step while running mvnw, it does not depend if npm 6.9.0 is installed
Reproduce the error
install jhipster create a project from the below .yo-rc.json run mvnw
JHipster Version(s)
6.0.0-beta.0
JHipster configuration
INFO! Using JHipster version installed locally in current project's node_modules INFO! Executing jhipster:info INFO! Options: from-cli: true Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Environment and Tools
java version "1.8.0_202" Java(TM) SE Runtime Environment (build 1.8.0_202-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
git version 2.21.0.windows.1
node: v10.15.3
npm: 6.9.0
INFO! Congratulations, JHipster execution is complete!
Browsers and Operating System
Windows 10 v.1809, OS Build: 17763.79