[ https://issues.apache.org/jira/browse/NIFI-2781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15496696#comment-15496696 ]
Scott Aslan edited comment on NIFI-2781 at 9/16/16 4:18 PM: ------------------------------------------------------------ The frontend-maven-plugin successfully installs node and npm through the install-node-and-npm execution AND it supports the installation of specific versions of each. It also caches node/npm in the local .m2 cache for offline builds. However the frontend-maven-plugin install-bower execution is broken (https://github.com/eirslett/frontend-maven-plugin/issues/461) and does not support requesting a specific version. This issues: * a. Broken build due to bower install failing * b. Nifi must support offline builds * c. **If possible** we would like to install node/npm/bower from a maven repository Below are the options and a description of how each option solves the issues: * 1. Remove the broken frontend-maven-plugin install-bower execution and instead create a package.json (with bower as the only dependency) and then allow npm to install bower. ** a. Fixes the build AND supports specific versioning of bower in package.json ** b. Bower supports an --offline flag and we already have a bower.options maven property setup to support any/all bower cli options…also the frontend-maven-plugin caches node/npm in the local .m2 cache for installation in offline mode. Npm also supports a –cache-min flag so we can install bower from the npm cache…. ** c. If we have control over a nexus repository we could throw the compressed node/npm/bower files in there… *** This solution fixes the build, installs specific node/npm versions online or offline via the local .m2 cache, installs a specific version of bower to be installed online or offline via the local .npm cache, and also allows bower to install nifi deps online or offline via the local .bower cache in a custom location. * 2. Remove bower and let npm handle deps. Most packages available through bower are also available through npm and it could be argued that npm is a *better* package manager (although for Nifi needs bower is fine) (https://gofore.com/stop-using-bower/) ** a. Fixes the build ** b. Npm supports a –cache-min that looks like it will work for Nifi’s offline needs but it has some short comings (https://addyosmani.com/blog/using-npm-offline/). There are some alternatives but these options seem to be work arounds to the problem or are unmaintained: (https://www.npmjs.com/package/offline-npm https://www.npmjs.com/package/npm-offline https://github.com/nolanlawson/local-npm ** c. If we have control over a nexus repository we could throw the compressed node/npm files in there… *** This solution fixes the build by removing bower altogether, installs specific node/npm versions online or offline via the local .m2 cache, and installs nifi deps online or offline view the local .npm cache. However npm is not so nice about allowing us to define a custom location for the installed deps. * 3. Remove node/npm/bower/frontend-maven-plugin and bundle client deps with Nifi like we do with jQuery and d3. ** a. Fixes the build ** b. Builds online or offline No need for node/npm/bower ** c. No need for node/npm/bower so all good was (Author: scottyaslan): The frontend-maven-plugin successfully installs node and npm through the install-node-and-npm execution AND it supports the installation of specific versions of each. It also caches node/npm in the local .m2 cache for offline builds. However the frontend-maven-plugin install-bower execution is broken (https://github.com/eirslett/frontend-maven-plugin/issues/461) and does not support requesting a specific version. This issues: * a. Broken build due to bower install failing * b. Nifi must support offline builds * c. **If possible** we would like to install node/npm/bower from a maven repository Below are the options and a description of how each option solves the issues: * 1. Remove the broken frontend-maven-plugin install-bower execution and instead create a package.json (with bower as the only dependency) and then allow npm to install bower. ** a. Fixes the build AND supports specific versioning of bower in package.json ** b. Bower supports an --offline flag and we already have a bower.options maven property setup to support any/all bower cli options…also the frontend-maven-plugin caches node/npm in the local .m2 cache for installation in offline mode. Npm also supports a –cache-min flag so we can install bower from the npm cache…. *** This solution fixes the build, installs specific node/npm versions online or offline via the local .m2 cache, installs a specific version of bower to be installed online or offline via the local .npm cache, and also allows bower to install nifi deps online or offline via the local .bower cache in a custom location. ** c. If we have control over a nexus repository we could throw the compressed node/npm/bower files in there… * 2. Remove bower and let npm handle deps. Most packages available through bower are also available through npm and it could be argued that npm is a *better* package manager (although for Nifi needs bower is fine) (https://gofore.com/stop-using-bower/) ** a. Fixes the build ** b. Npm supports a –cache-min that looks like it will work for Nifi’s offline needs but it has some short comings (https://addyosmani.com/blog/using-npm-offline/). There are some alternatives but these options seem to be work arounds to the problem or are unmaintained: (https://www.npmjs.com/package/offline-npm https://www.npmjs.com/package/npm-offline https://github.com/nolanlawson/local-npm *** This solution fixes the build by removing bower altogether, installs specific node/npm versions online or offline via the local .m2 cache, and installs nifi deps online or offline view the local .npm cache. However npm is not so nice about allowing us to define a custom location for the installed deps. ** c. If we have control over a nexus repository we could throw the compressed node/npm files in there… * 3. Remove node/npm/bower/frontend-maven-plugin and bundle client deps with Nifi like we do with jQuery and d3. ** a. Fixes the build ** b. Builds online or offline No need for node/npm/bower ** c. No need for node/npm/bower so all good > Broken bower install > -------------------- > > Key: NIFI-2781 > URL: https://issues.apache.org/jira/browse/NIFI-2781 > Project: Apache NiFi > Issue Type: Bug > Components: Tools and Build > Affects Versions: 1.0.0 > Reporter: Andrew Psaltis > Assignee: Scott Aslan > > Often times when building the NiFi source, the installation of bower fails > and thus the whole build fails. > Looking at a mvn debug log, appears to show this: > [INFO] Running 'npm install bower' in > /Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/target/frontend-working-directory > [WARNING] npm WARN package.json mqlight@1.0.2016051011 No repository field. > [ERROR] npm http GET https://registry.npmjs.org/bower > [ERROR] npm http 200 https://registry.npmjs.org/bower > [INFO] bower@1.7.9 ../../../../../../../../../node_modules/bower > [INFO] > [INFO] --- frontend-maven-plugin:1.0:bower (bower-install) @ nifi-web-ui --- > [DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.0:bower > from plugin realm > ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.0, parent: > sun.misc.Launcher$AppClassLoader@55f96302] > [DEBUG] Configuring mojo > 'com.github.eirslett:frontend-maven-plugin:1.0:bower' with basic configurator > --> > [DEBUG] (f) arguments = install > --config.directory=/Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/target/nifi-web-ui-1.0.0-SNAPSHOT/assets > [DEBUG] (f) installDirectory = > /Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/target/frontend-working-directory > [DEBUG] (f) project = MavenProject: > org.apache.nifi:nifi-web-ui:1.0.0-SNAPSHOT @ > /Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml > [DEBUG] (f) repositorySystemSession = > org.eclipse.aether.DefaultRepositorySystemSession@315edc50 > [DEBUG] (f) session = org.apache.maven.execution.MavenSession@4052c8c2 > [DEBUG] (f) skip = false > [DEBUG] (f) skipTests = false > [DEBUG] (f) workingDirectory = > /Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/target/frontend-working-directory > [DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.0:bower > {execution: bower-install} > [DEBUG] -- end configuration -- > [INFO] Running 'bower install > --config.directory=/Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/target/nifi-web-ui-1.0.0-SNAPSHOT/assets' > in > /Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/target/frontend-working-directory > [ERROR] > [ERROR] module.js:340 > [ERROR] throw err; > [ERROR] ^ > [ERROR] Error: Cannot find module > '/Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/target/frontend-working-directory/node_modules/bower/bin/bower' > [ERROR] at Function.Module._resolveFilename (module.js:338:15) > [ERROR] at Function.Module._load (module.js:280:25) > [ERROR] at Function.Module.runMain (module.js:497:10) > [ERROR] at startup (node.js:119:16) > [ERROR] at node.js:901:3 > [INFO] > ------------------------------------------------------------------------ > In essence bower is not installed. This is reproducible in my environment, > which looks like this: > $ printenv > TERM_PROGRAM=iTerm.app > TERM=xterm > SHELL=/bin/bash > TMPDIR=/var/folders/5l/xlzh00b10_lf16cd06dqwvs40000gn/T/ > Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.jdxbKLHhHZ/Render > TERM_PROGRAM_VERSION=3.0.7 > OLDPWD=/Users/apsaltis/development/forked-nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui > TERM_SESSION_ID=w0t0p1:4401C1E6-AF27-43E2-91BF-7814B628BEC1 > USER=apsaltis > SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.VHh1dBoww3/Listeners > __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0 > PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sb... > PWD=/Users/apsaltis/development/forked-nifi > JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home > LANG=en_US.UTF-8 > ITERM_PROFILE=Default > XPC_FLAGS=0x0 > XPC_SERVICE_NAME=0 > SHLVL=1 > HOME=/Users/apsaltis > COLORFGBG=7;0 > ITERM_SESSION_ID=w0t0p1:4401C1E6-AF27-43E2-91BF-7814B628BEC1 > LOGNAME=apsaltis > _=/usr/bin/printenv -- This message was sent by Atlassian JIRA (v6.3.4#6332)