NPM fails on command with 'npm run <task>'
See original GitHub issuePrerequisites:
- Maven configuration:
<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>v0.12.2</nodeVersion>
<npmVersion>2.7.6</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
</executions>
</plugin>
- package.json:
...
"scripts": {
"postinstall": "npm run wiredep",
"prestart": "npm install",
"start": "http-server -a 127.0.0.1 -p 8002",
"wiredep": "wiredep --verbose --bowerJson bower.json --src src/main/resources/public/index.html"
}
...
- Node.js/npm is not installed globally.
While running ‘mvn install’ the following error is thrown:
[INFO] --- frontend-maven-plugin:0.0.23:npm (npm install) @ project-web-client ---
[INFO] Running 'npm install --color=false' in C:\work\projects\project-web-client
[INFO]
[INFO] > project-web-client@4.0.11-SNAPSHOT postinstall C:\work\projects\project-web-client
[INFO] > bower install && npm run wiredep
[INFO]
[ERROR] 'npm' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
[ERROR]
[ERROR] npm ERR! Windows_NT 6.3.9600
[ERROR] npm ERR! argv "C:\\work\\projects\\project-web-client\\node\\node" "C:\\work\\projects\\project-web-client\\node\\npm\\bin\\npm-cli.js" "install" "--color=
false"
[ERROR] npm ERR! node v0.12.2
[ERROR] npm ERR! npm v2.7.6
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! project-web-client@0.0.11-SNAPSHOT postinstall: `bower install && npm run wiredep`
[ERROR] npm ERR! Exit status 1
Note: if package.json has a command in postinstall phase like ‘bower install’ it works correctly.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
npm-run-script
Description. This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts.
Read more >VS Code automatic npm build fails with "npm command not ...
The issue is likely because npm isn't in VS Code's path (likely /usr/bin ). However, you can create a custom build task and...
Read more >Unable to run npm test as a task. - Atlassian Community
I'm currently trying to run 'npm test' as a task. The command is simply 'test'. When I try to run my build plan...
Read more >how do I execute an npm run script from a VSTS build task?
Open powershell prompt on your machine, and then type the npm commands. They should fail with the same error.. Click to vote up....
Read more >Re: [Opencast] Failed to run task: 'npm run build --no-color
To address your issue, we need the part of the build above the list of modules to tell exactly what's going wrong, but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Copy this file: https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plugin/src/it/example project/helper-scripts/npm into your project root directory (the same directory as the pom.xml file and/or the package.json file) and try again!
If you’re building on Windows, you should add this as well: https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plugin/src/it/example project/helper-scripts/npm.cmd
Then try running the maven build again. If that works, commit these two files into your repository.
Here is my pom:
The second execution, npm install doesn’t run. When I run “mvn clean install” I get the following — frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) @ myproject — [INFO] Node v6.9.5 is already installed. [INFO] NPM 3.10.10 is already installed. [INFO] [INFO] — frontend-maven-plugin:1.4:npm (npm install) @ myproject — [INFO] Running ‘npm install’ in /Users/myproject
Waited more than 30 mins but doesn’t do anything after this. Tried few times and it is same each time. Would appreciate any help.