Build Failed: NPM: command not found - ReactJS project - node.js

I am absolute beginner in Jenkins started learning from yesterday. I went through theory session yesterday that went quit well. However, on when I am trying hands on it I stuck with probably petty issue for Jenkins user.
I am running Jenkins on my mac machine and it's a completely brand new setup
here is the error
+ echo 'build start...'
build start...
[first-job] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/jenkins2233817479314329111.sh
+ npm install
/Users/Shared/Jenkins/tmp/jenkins2233817479314329111.sh: line 2: npm: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Project config.

Related

fbthrift folly/folly/stats/test won't build on Ubuntu 14.04

We installed Ubuntu 14.04.
We want to install fbthrift there.
We did the git clone of fbthrift.
We then did a git checkout of version v2017.06.05.00.
We followed the guidance in README.md, and ran the script called ./build/deps_ubuntu_14.04.sh
It dies trying to build fbthrift/thrift/build/deps/folly/folly/stats/test
saying "*** No rule to make target 'all'. Stop."
It just finished successfully building in .../folly/folly/io/test.
Interestingly, io/test has a Makefile.am, a Makefile.in, and a Makefile.
stats/test only has a Makefile.am.
I don't know where in this automated script the "autoconf" and "automakers" steps were supposed to be executed on stats/test.
Help?

Azure web app on linux deployment failed on deploy.ssh

Is there any guide to manage to deploy.sh script in Azure Web App on Linux for nodejs app? I am consistently getting deployment errors on running the command on the continuous deployment. The error starts with the 1st deployment script when I first setup the continuous deployment. The error mostly happened at "bower install" command where bower command is not found with bash command line.
To overcome this issue, I performed the following:
Login to Kudu tool, Bash (ssh is not working on the 1st time)
Run "npm install --production", but this will not complete the installation
Run "bower install", getting error bower not install - tried with npm install -g bower - it's still not solving the problem.
somehow, I tried several times to open/close Kudu tool, until SSH starts to load(miracle)
with SSH terminal, I am able to perform "npm install -g bower" and "bower install", which concluded the installation and I'm able to load my website
However, the status of the deployment will still stay failed and subsequence deployment does not seem to have been improved at all as it failed at the deployment script.
The following is the error generated from subsequence deployment:
Command: "/home/site/deployments/tools/deploy.sh"
/opt/Kudu/bin/Scripts/starter.sh: /home/site/deployments/tools/deploy.sh: /bin/bash^M: bad interpreter: No such file or directory
/opt/Kudu/bin/Scripts/starter.sh: line 2: /home/site/deployments/tools/deploy.sh: Success
/opt/Kudu/bin/Scripts/starter.sh: /home/site/deployments/tools/deploy.sh: /bin/bash^M: bad interpreter: No such file or directory\n/opt/Kudu/bin/Scripts/starter.sh: line 2: /home/site/deployments/tools/deploy.sh: Success\n/opt/Kudu/bin/Scripts/starter.sh "/home/site/deployments/tools/deploy.sh"
Hope experts from MS can help me on this matter. Thank you.
Best regards,
Szelee
On Linux, it's important that any bash deployment scripts that get run have Unix line endings (LF) and not Windows line endings (CRLF). Kuduscript will generate scripts with platform-appropriate line endings, but if those scripts are modified, or if you provide your own custom deployment scripts, it's important to make sure that your editor doesn't change the line endings.
If something seems off with your deployment script, you can always use the Kudu console to delete the contents of /home/site/deployments/tools. This is the directory where Kudu caches kuduscript-generated deployment scripts. On the next deployment, the script will be regenerated.

Running nodejs command on gocd pipeline

I created a new gocd pipeline and have three shell script files to run on different stages.
The problem is the go agent doesn't know npm.
Note: I have npm installed on the machine with go agent and I manually run the shell script from the pipeline.
Here is my shell script to install the packages.
#!/bin/sh
npm install
The error:
01:34:43.674 [go] Start to execute task: <exec command="./install.sh" />.
01:34:43.680 ./install.sh: line 3: npm: command not found
01:34:43.814 [go] Current job status: failed.
Problem
Assuming you have npm/nodejs installed on the agent, the problem probably lies in the fact the user doesn't have its PATH environment variable configured to look into the folder npm was installed in.
Solution
1) You can specify the whole path (/usr/bin/npm) when creating a task.
2) You can edit the .bashrc/.bash_profile of the user running the gocd agent server. In which case you'll be able to call '/usr/bin/npm' without the path prepended.
Example Working Configuration
Consider modification of the agent init script. Changing .bashrc/.bash_profile of the user running the gocd agent does not work because the go agent insulates itself from the calling environment. So on our systems we add these PATH items to the go agent startup scripts. (I use puppet to create agents. The default agent init scripts are not that good - you need to own them.)

Generating Release APK Fails at bundleReleaseJsAndAssets

Every time I try to run: ./gradlew assembleRelease I get the following:
FAILURE: Build failed with an exception.
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command 'react-native''
Here is the output of the stacktrace: https://gist.github.com/rpastorelle/f0a42a87656e5326a186de4e34f691a0
It does work if I use sudo to run that command. However, that majorly screws up some permissions and then I get "Could not expand ZIP" errors in Android Studio when building a debug version.
My global npm modules are in /usr/local/lib/node_modules & I am the user that owns that folder. react-native-cli was not installed using sudo.
My workaround is to run ./gradlew --stop (which stops the daemon)
If ./gradlew assembleRelease does't want to generate new index.android.bundle file in the assets folder then put the code in app/build.gradle mentioned on https://stackoverflow.com/a/58458802/3880451 to disable bundleJsAndAssets.

Running Karma from TeamCity

Does anyone know how you would run the following command within TeamCity? (the command is normally ran in a Node.js command window)..."Karma start karma.conf.js". I have successfully installed Nodejs on the TeamCity server. I have then successfully installed Karma on the same server (using npm install -g karma).
In TeamCity, my build step has "Runner type = Command Line", and the Custom Script is set to "FULLPATHOFKARMAEXE\karma.cmd start FULLPATHOFKARMACONFIGFILE/kara.conf.js"
When i run TeamCity, it comes back with the error "node is not recognized as an internal or external command"
Anyone know the step-by step process of running Karma within TeamCity?
In your case, the Karma installation seems to be OK, but your TeamCity agent process is unable to resolve the path to Node.exe (it's installation folder is missing from the %PATH% variable).
First verify the NodeJS installation by opening a Commandline window on the agent machine, type node and press enter:
c:> node
>
If the result in your Command window is a >-prompt, you might solve your problems by restarting the build agent.
If the result in your Command window is some error message saying "node is not recognized as an internal or external command", you need to add the NodeJS installation folder to the %PATH% variable, and restart the build agent.
You can, of course, just change the %PATH% for your build agent service by running a initialization script included in the NodeJS installtion folder in your build step. Depending on where your NodeJS installastion is, your custom script might look like this:
"C:\Program Files (x86)\nodejs\nodevars.bat"
"FULLPATHOFKARMAEXE\karma.cmd start FULLPATHOFKARMACONFIGFILE/kara.conf.js"

Resources