I have installed nodejs (npm) and npm install grunt-cli on my ubuntu box. I have found the nice maven-ant-run configuration for maven:
https://gist.github.com/nadavdav/5308453
but when I run mvn clean install from command-line I get:
building:
[echo] ---------------------------------------------------
[echo] -- NPM INSTALL --
[echo] ---------------------------------------------------
[exec] /usr/bin/npm: npm: line 2: syntax error near unexpected token `;'
[exec] /usr/bin/npm: npm: line 2: `;(function () { // wrapper in case we're in module_context mode'
Why does npm fail when running inside maven?
EDIT: I have now updated the config to:
<!-- <exec executable="bash" dir="${project.basedir}" osfamily="unix" -->
<!-- failonerror="true"> -->
<!-- <arg line="npm install" /> -->
<!-- </exec> -->
<!-- WORKING -->
<exec executable="npm" dir="${project.basedir}" failonerror="true">
<arg value="install" />
</exec>
which works. But strange that it does not work when running the original version.
Because in the first example, you were running 'bash' with the argument 'npm install', which is the same as running bash npm install
on the commandline. This tells bash to try to run 'npm' as a shell script, but the npm
script in your path is javascript code. Try it:
john-warden-mba-2012:nodetest john$ bash npm install
/opt/local/bin/npm: npm: line 2: syntax error near unexpected token `;'
/opt/local/bin/npm: npm: line 2: `;(function () { // wrapper in case we're in module_context mode'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With