I'm setting up a release pipeline for my ASP.NET Core Angular Application from Visual Studio 2017 and I'm running into major problems with the npm task locating the package.json file. I know the file is there - it was initially in the ClientApp folder, and I've also added it to the main folder, and the dist folder for testing purposes while I was trying to figure out why it doesn't like my file!
I have literally tried every possibility, including using the $(System.DefaultWorkingDirectory). This is my first time working in Azure DevOps and my first time trying to set up pipelines. I've googled endlessly and even tried re-queueing the build pipeline.
It's completely possible I've set up the wrong type of release pipeline. I chose an empty job and I have 3 tasks - npm install, npm build, and publish artifact (I've been trying to follow some online tutorials). I also made my build pipeline from an ASP.Net Core template, ran the yaml file, etc.
As a note, I did install node.js and angular, and ensured the proper files are in my dist folder. I've added a web.config file, added it to my assets in the angular json file. I have also added a small script to the package.json folder to actually build.
"project": {
"name": "Test"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"src/web.config"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"name": "Test",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prod-build-dev": "ng build --prod --build-optimizer",
"prod-build-staging": "ng build --prod --configuration=staging --build-optimizer"
},
I expect the npm task to find the package.json file but that's not what is happening. Please see these error messages, each of which shows up for a different input for the working folder that contains package.json. In one, it cannot find the directory. In the other, it cannot find the file.
Error #1: Error: Npm failed with return code: 4294963238
paired with:
14 error enoent ENOENT: no such file or directory, open 'D:\a\r1\a\package.json' 2019-08-10T15:08:12.2500818Z 15 error enoent This is related to npm not being able to find a file.
and
Error #2: Error: ENOENT: no such file or directory, stat 'D:\a\r1\a\Test\ClientApp\dist'
$(Build.SourcesDirectory)
for CI side. – jessehouwing$(System.ArtifactsDirectory)/{Artifact Alias for the whole build}/{Artefact name in the publish pipeline artifact task}/
. Often it helps to run adir /s /b
orfind .
from the$(System.WorkFolder)
to see where stuff ended up. – jessehouwing