npm: not found when setting up Jenkins Server? - javascript

This is my first time setting up a jenkins server. The build is using Amazon's EC2 and Ubuntu 14.04.
I've installed node and npm via nvm.
node -v
>v0.11.14
npm -v
>2.0.0
The repo pulls down just fine into my /var/lib/jenkins/workspace/morningharwood folder.
Problem: When I add my script it breaks
Here's my build script which errors out? I have no idea what i'm doing. I copied this from a tutorial.
QUESTION: How do I properly write my script to npm install, bower install and lastly, grunt test

You could install node, npm, bower and grunt by doing following:
sudo apt-get install node
sudo npm install bower
sudo npm install grunt
To install a package from local source, use
npm install /path

Try using NodeJS plugin for Jenkins: https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin

This will solve npm command not found issue on jenkins even installed on server
sudo mkdir /usr/local/nvm
export NVM_DIR=/usr/local/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh |NVM_DIR=/usr/local/nvm bash
. /usr/local/nvm/nvm.sh
nvm install 10.15.3 -g
npm install #angular/cli -g
Include following on build execute shell command in jenkins:
export PATH="$PATH:/usr/local/nvm/versions/node/v10.15.3/bin"
npm install

Related

Can I install react native Cli through terminal globally?

I want to install react-native cli but I don't where to run this command: npm install -g react-native-cli. Do I need to run this command on my macOS terminal or when I will make a directory for my react native app then there I need to run this command in vscode?
Is there any issue if I run this command in my terminal or If I run this in VScode?
React Native is distributed as two npm packages, react-native-cli and react-native.
The first one is a lightweight package that should be installed globally (npm install -g react-native-cli), while the second one contains the actual React Native framework code and is installed locally into your project when you run react-native init.
Because react-native init calls npm install react-native, simply linking your local GitHub clone into npm is not enough to test local changes.
npm install –g react-native-cli
· This line installs the npm package react-native-cli along with its dependencies(from the npm repository host) inside the globally shared node_modules folder.
· Global install (with -g): puts stuff in /usr/local or wherever node is installed. This will also allow you to access the module from the command-line, as the bin is symlinked into a PATH folder (usually usr/local/bin).
Refer below link
https://rlogicaltech.medium.com/how-to-install-react-native-on-mac-step-by-step-guide-1ac822aedd4f
You can run the command anywhere in the terminal.
It will install the react-native-cli globally as we are specifying the "-g" option in the command.
Use this
npm install -g expo-cli
this how I solved it.
npm install -save react-native#latest

how to set environment variable in lumber framework?

Install Lumber
npm install -g lumber-cli -s
then,
lumber generate "adminpanel_test" --connection-url "mysql://root#localhost:3306/admin-dev" --ssl "false" --application-host "localhost" --application-port "3310"
lumber is not recognized as an internal or external command
lumber-cli is not installed properly on your shell.
If you run this you can see the reason why it is stop installing.
npm install -g lumber-cli
Sometimes it can work if you are working on local env.
sudo npm install -g lumber-cli
You can also try to install it locally:
$ npm install —save-dev lumber-cli

Troubles with Angular CLI installing

I have installed node (v 8.5.0) with npm (5.3.0).
After that I made: npm install -g #angular/cli but it doesn't work:
ng help
-bash: ng: command not found
here are installation logs:
MacBook-Air:~ michael$ npm install -g #angular/cli
/Users/michael/.npm-global/bin/ng -> /Users/michael/.npm-global/lib/node_modules/#angular/cli/bin/ng
+ #angular/cli#1.4.3
updated 1 package in 39.276s
You can check out this issue on github.
It seems like they are running npm install again possibly needing admin privileges as well.

Cannot Find Gulp Modules

For some reason, when i type gulp in the terminal, my gulp modules can't be found.
All of the commands node -v, gulp -v and npm -v work fine and i have the latest versions.
I ran this commands but it still won't work.
npm uninstall -g gulp
npm install -g gulp
rm -rf node_modules
npm install
This is my project, https://github.com/DannyS95/Project
I also tried to run the same project on my windows volume and the gulp command works fine, it just won't work on ubuntu, i am dual booting.
Do not commit node_modules/ unless you have need.
The error message says you do not have gulp-plumber installed. If you look in your package.json, there does not exist a package named gulp-plumber, so install it.

jscoverage does not work without -g option

npm install jscoverage -g
What does the -g option do?
If I skip the -g option, jscoverage is not recognized as a valid command.
The -g flag tells npm to install it globally to your PATH. Without that, it would just be installed locally into your project folder.

Categories