Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Devops NPM Please change your working directory to a valid directory

I am trying to build a project with npm run-script build

my package.json is like this

{
  "name": "isomorphic",
  "version": "2.6.0",
  "private": true,
  "dependencies": {
    "adal-angular": "^1.0.17",
    "antd": "^3.0.3",
    "antd-local-icon": "^0.1.3",
    "axios": "^0.18.0",
    "classnames": "^2.2.5",
    "clone": "^2.1.1",
    "history": "^4.6.3",
    "nprogress": "^0.2.0",
    "postcss-inline-rtl": "^0.9.8",
    "q": "^1.5.1",
    "react": "^16.2.0",
    "react-adal": "^0.4.17",
    "react-dom": "^16.2.0",
    "react-highlight-words": "^0.16.0",
    "react-intl": "^2.3.0",
    "react-placeholder": "^2.0.0",
    "react-redux": "^5.0.4",
    "react-router": "^4.1.1",
    "react-router-dom": "^4.1.0",
    "react-router-redux": "^5.0.0-alpha.5",
    "react-scripts": "1.0.17",
    "react-sidebar": "^2.3.2",
    "react-smooth-scrollbar": "^8.0.6",
    "react-throttle": "^0.3.0",
    "react-window-size-listener": "^1.0.10",
    "redux": "^3.6.0",
    "redux-devtools": "^3.3.2",
    "redux-devtools-dock-monitor": "^1.1.1",
    "redux-devtools-log-monitor": "^1.2.0",
    "redux-saga": "^0.16.0",
    "redux-thunk": "^2.2.0",
    "smooth-scrollbar": "^8.2.5",
    "styled-components": "^2.2.1",
    "styled-theme": "^0.3.3",
    "webpack-cli": "^3.2.3"
  },
  "devDependencies": {
    "react-app-rewired": "^1.4.0",
    "webpack": "^4.29.5"
  },
  "scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

and my build definition is like this enter image description here

However I still get this error: Azure Devops NPM Please change your working directory to a valid directory

like image 776
Luis Valencia Avatar asked Mar 19 '19 03:03

Luis Valencia


People also ask

How do I specify npm in Azure pipeline?

You could add replace token task in the first step of the pipeline. In other words, run replace token task before executing npm task(npm run build). This task is used to assign a value to the version field. In this case, it should work.

What is npm in Azure DevOps?

You can use an Azure DevOps pipeline to build, deploy, and test JavaScript apps. This quickstart walks through how to use a pipeline to create a Node. js package with Node Package Manager (npm) and publish a pipeline artifact.

What is NPX vs npm?

NPM is a package manager used to install, delete, and update Javascript packages on your machine. NPX is a package executer, and it is used to execute javascript packages directly, without installing them.


2 Answers

In the field Working folder that contains package.json you specified the file itself and not the folder path. you just need to put the folder path that contains the package.json.

enter image description here

like image 93
Shayki Abramczyk Avatar answered Sep 28 '22 18:09

Shayki Abramczyk


Just leave empty "Working folder with package.json" field

Just leave empty "Working folder with package.json" field

like image 21
Mehmet Avatar answered Sep 28 '22 19:09

Mehmet