简体   繁体   English

如果我的项目不在根目录中,如何从 Jenkins 执行 npm install 和 npm

[英]How do I execute npm install and npm from Jenkins if my project is in not in the root directory

Lets say I have in private repository directory called project.假设我在名为 project 的私有存储库目录中。 So I want either copy what inside this folder to Jenkins workspace or copy all repository but run npm install(npm run) from Workspace/project/.所以我想要么将此文件夹中的内容复制到 Jenkins 工作区,要么复制所有存储库但从 Workspace/project/ 运行 npm install(npm run)。

How do I execute npm install and npm from Jenkins if my project is in not in the root directory --prefix path doesn't work如果我的项目不在根目录中,如何从 Jenkins 执行 npm install 和 npm --prefix path 不起作用

Here is a simple pipeline code for you to build on top of.这是一个简单的管道代码,供您在其上构建。

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                // Clone your repo
                git 'https://github.com/jglick/simple-maven-project-with-tests.git'
            }
        }
        stage('NPM Run') {
            steps {
                // dir will execute you commands within this directory. Another option is to cd in to the project directory and execute your command.  
                dir('project') {
                    sh "npm run wdio" 
                }
            }

        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npm install 正在我的 angular 项目根目录中构建 .cmd 文件 - npm install is building .cmd files in my angular project root directory 我如何为我的 npm 安装计时? - How do I time my npm install? 如何在我的项目中从 npm 切换到 yarn? - How do I switch from npm to yarn in my project? 如何防止“ npm install”或“ npm remove”删除我的个人软件包? - How do I prevent “npm install” or “npm remove” from deleting my personal package? 当我在运行 npm 安装命令后收到错误时,如何从 github 克隆我的反应项目后运行 - How do I get my react project running after cloning it from github as I receive errors after running npm install command 如何在特定目录中安装npm软件包 - How do I install npm packages in specific directory NPM:我应该使用依赖项之一的依赖项,还是应该在根级别将其明确安装到项目中? - NPM: should I use one of my dependencies' dependencies, or should I explicitly install it into the project at the root level? 无法在我的Gulp + Angular项目上执行npm install - Not able to execute npm install on my Gulp+Angular project Windows Service在我的NodeJS项目目录上执行`npm start` - Windows Service to execute `npm start` on my NodeJS project directory 如何 npm install global 不是 root? - How to npm install global not as root?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM