I have a little test electron app named hello world. I am trying to build it and generate a windows installer using electron-builder. My package.json is as follows.
{
"name": "hello-world",
"productName": "Hello World",
"version": "1.0.0",
"description": "Second attempt at an electron app",
"main": "main.js",
"dependencies": {},
"devDependencies": {
"electron": "^9.1.1",
"electron-builder": "^22.8.0"
},
"scripts": {
"start": "electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Computronics",
"license": "MIT",
"build": {
"appId": "com.hello.world",
"win": {
"target": "nsis"
}
}
}
When I run npm run dist it outputs this.
> hello-world#1.0.0 dist C:\Users\computronics\source\repos\electrontests\hello world
> electron-builder
• electron-builder version=22.8.0 os=10.0.18362
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist\builder-effective-config.yaml
• packaging platform=win32 arch=x64 electron=9.1.2 appOutDir=dist\win-unpacked
⨯ EBUSY: resource busy or locked, rename 'C:\Users\computronics\source\repos\electrontests\hello world\dist\win-unpacked\electron.exe' -> 'C:\Users\computronics\source\repos\electrontests\hello world\dist\win-unpacked\Hello World.exe' stackTrace=Error: EBUSY: resource busy or locked, rename 'C:\Users\computronics\source\repos\electrontests\hello world\dist\win-unpacked\electron.exe' -> 'C:\Users\computronics\source\repos\electrontests\hello world\dist\win-unpacked\Hello World.exe'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-world#1.0.0 dist: `electron-builder`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-world#1.0.0 dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\computronics\AppData\Roaming\npm-cache\_logs\2020-07-31T19_00_12_846Z-debug.log
The contents of the log file is as follows:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dist'
1 verbose cli ]
2 info using npm#6.14.6
3 info using node#v12.18.3
4 verbose run-script [ 'predist', 'dist', 'postdist' ]
5 info lifecycle hello-world#1.0.0~predist: hello-world#1.0.0
6 info lifecycle hello-world#1.0.0~dist: hello-world#1.0.0
7 verbose lifecycle hello-world#1.0.0~dist: unsafe-perm in lifecycle true
8 verbose lifecycle hello-world#1.0.0~dist: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\computronics\source\repos\electrontests\hello world\node_modules\.bin;C:\Program Files\Microsoft VS Code\bin;C:\Windows\System32;C:\Program Files\Git\cmd;C:\Program Files\PowerShell\7-preview\preview;C:\ProgramData\chocolatey\bin;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\Users\computronics\.dotnet\tools;
9 verbose lifecycle hello-world#1.0.0~dist: CWD: C:\Users\computronics\source\repos\electrontests\hello world
10 silly lifecycle hello-world#1.0.0~dist: Args: [ '/d /s /c', 'electron-builder' ]
11 silly lifecycle hello-world#1.0.0~dist: Returned: code: 1 signal: null
12 info lifecycle hello-world#1.0.0~dist: Failed to exec dist script
13 verbose stack Error: hello-world#1.0.0 dist: `electron-builder`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid hello-world#1.0.0
15 verbose cwd C:\Users\computronics\source\repos\electrontests\hello world
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dist"
18 verbose node v12.18.3
19 verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error hello-world#1.0.0 dist: `electron-builder`
22 error Exit status 1
23 error Failed at the hello-world#1.0.0 dist script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
After running npm run dist it creates a working .exe in dist called electron.exe. This launches into the simple hello world app.
I have tried deleting the node_modules folder and reinstalling the dependencies, forcefully cleaning the npm cache and trying different versions of electron-builder.
Other information
OS: Windows 10
npm version: 6.14.6
node version: 12.18.3
Thanks in advance for any help.
There may be more than one reason for this error. Here are the ways you can get rid out of this error.
Solution 1. Close the browser_broker process
Open up the Windows task manager, find the running process named either browser_broker.exe or Runtime Broker and stop the process. After stopping the process, try building the installer again and it will work.
Solution 2. Kill the Build Tools Process
Open task manager and kill the BuildTolls_Full.exe process. Then Go to C:\Users<User Name>.windows-build-tools and open build-tools-log.txt with a text-editor and append the given and save the file.
Variable: IsInstalled = 1
Related
I create a project with create-react-app. I get this error when i run docker build frontend -t my-frontend . :
> frontend#0.1.0 build /app
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to load plugin 'jest' declared in 'package.json » eslint-config-react-app/jest': Cannot read property 'meta' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-01-27T11_11_23_140Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
how should i fix it? i tried npm install,npm install .,npm audit fix.
this is jest in my package.json :
{
...
"dependencies": {
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
...,
"web-vitals": "^1.0.1"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
...
}
and this is jest in my package.lock.json :
"eslint-plugin-jest": {
"version": "24.1.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz",
"integrity": "...",
"requires": {
"#typescript-eslint/experimental-utils": "^4.0.1"
}
},
I also saw eslint-plugin-jest gives "ESLint stack trace: TypeError: Cannot read property 'meta' of undefined" that says: " This was a temporary issue in 22.6 up to 22.6.2" but my version is 24.1.3 .
Fixed by npm audit fix --force but before run, make sure it does not damage your project.
npm audit fix only modifies the dependencies that shouldn't cause problems based on SEMVER rules. The --force is a dangerious option because it upgrades the dependencies regardless of any rules. This can cause a dependency to go from version 1.2. 0 to version 2.3.
What did a npm audit fix --force change and how do you fix it?
I'm using this package to compile and build my extension
{
"id": "extensionAzureDevOps",
"name": "extension",
"publisher": "ME",
"version": "0.0.63",
"description": "Azure DevOps Extension",
"keywords": [
"extensions",
"Azure DevOps",
"Visual Studio Team Services"
],
"engines": {
"vscode": "^1.8.0"
},
"license": "MIT",
"repository": {
"type": "git",
"url": ""
},
"scripts": {
"clean": "rimraf ./dist",
"compile": "npm run clean && npm run test && webpack --mode production",
"compile:dev": "npm run clean && npm run test && webpack --mode development",
"build": "npm run compile",
"build:dev": "npm run compile:dev && npm run postbuild",
"postbuild": "npm run package-extension -- --rev-version",
"package-extension": "tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json",
"publish-extension": "tfx extension publish --manifest-globs azure-devops-extension.json src/TabExtension/*.json",
"test": "set TEST_REPORT_FILENAME=test-results.xml && jest --verbose"
},
"dependencies": {
"#fluentui/react": "^8.36.3",
"azure-devops-extension-api": "~1.157.0",
"azure-devops-extension-sdk": "~2.0.11",
"azure-devops-ui": "~2.164.0",
"react": "~16.13.1",
"react-dom": "~16.13.1"
},
"devDependencies": {
"#testing-library/jest-dom": "^5.11.0",
"#testing-library/react": "^10.4.4",
"#types/jest": "^26.0.3",
"#types/react": "~16.8.2",
"#types/react-dom": "~16.8.0",
"copy-webpack-plugin": "^7.0.0",
"base64-inline-loader": "~1.1.1",
"css-loader": "~1.0.0",
"jest": "^26.1.0",
"jest-junit-reporter": "^1.1.0",
"node-sass": "^5.0.0",
"rimraf": "~2.6.2",
"sass-loader": "~10.0.5",
"style-loader": "~0.23.1",
"tfx-cli": "^0.6.3",
"ts-jest": "^26.1.1",
"ts-loader": "~5.2.2",
"typescript": "^3.9.6",
"webpack": "^5.23.0",
"webpack-cli": "^4.5.0"
},
"jest": {
"transform": {
"^.+\\.(js|ts|tsx|jsx)$": "ts-jest"
},
"transformIgnorePatterns": [
"node_modules/(?!(react-native|azure-devops-ui|azure-devops-extension-sdk)/)"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "<rootDir>/src/__mocks__/styleMock.js"
},
"preset": "ts-jest/presets/js-with-babel",
"testResultsProcessor": "./node_modules/jest-junit-reporter",
"collectCoverage": true,
"coverageReporters": [
"json",
"html",
"cobertura"
],
"globals": {
"ts-jest": {
"tsconfig": "tsconfig.test.json"
}
}
}
}
When I run the command npm run postbuild, I receive this error:
tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json "--rev-version"
tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json "--rev-version"
(node:89172) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
TFS Cross Platform Command Line Interface v0.6.4
Copyright Microsoft Corporation
error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Inplace
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! feedback-extension-for-azuredevops#0.0.63 package-extension: `tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json "--rev-version"`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the feedback-extension-for-azuredevops#0.0.63 package-extension script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\t-nashak\AppData\Roaming\npm-cache\_logs\2021-12-08T15_15_13_712Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! feedback-extension-for-azuredevops#0.0.63 postbuild: `npm run package-extension -- --rev-version`
npm ERR! Exit status 4294967295
npm ERR!
But when I run the command tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json --rev-version it works well
what causes the dependencies cycle? how can I fix it?
note: if I remove the param --rev-version it will work well
I had the same issue. I guess the postbuild command is wrong:
"postbuild": "npm run package-extension -- --rev-version"
This works:
"postbuild": "npm run package-extension --rev-version"
I have jenkins installed on ubuntu and I installed the node Plugin and configured for the latest version of node with npm under the global tool configuration.
I am testing to run a pipeline where i will git clone and do a npm install and a npm test for my repo.
a sample is as below for my pipeline code:
pipeline {
environment{
registry = "xxxx"
registyCredential = 'harbor'
dockerImage = ''
}
agent any
tools{
nodejs "node"
}
stages {
stage('Git clone'){
steps{
git branch: 'development', url: 'https://github.com/leeadh/node-jenkins-app-example.git'
}
}
stage('Installing Node') {
steps {
sh 'npm install'
}
}
stage ('Conducting Unit test'){
steps{
sh 'npm test'
}
}
However, I keep getting a
976 verbose stack at ChildProcess.<anonymous> (/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
976 verbose stack at ChildProcess.emit (events.js:193:13)
976 verbose stack at maybeClose (internal/child_process.js:999:16)
976 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
977 verbose pkgid playground#1.0.0
978 verbose cwd /var/lib/jenkins/workspace/Compile_Code_CI
979 verbose Linux 4.15.0-29-generic
980 verbose argv "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/bin/node" "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/bin/npm" "install"
981 verbose node v11.14.0
982 verbose npm v6.7.0
983 error file sh
984 error code ELIFECYCLE
985 error errno ENOENT
986 error syscall spawn
987 error playground#1.0.0 install: `npm-git install`
987 error spawn ENOENT
988 error Failed at the playground#1.0.0 install script.
988 error This is probably not a problem with npm. There is likely additional logging output above.
I tried to directly install node JS on to my ubuntu server but it still gives me the same error.
Any help?
PS: a strange thing is that I tried these same exact steps on another jenkins server (this one is running on docker) and it was working perfectly fine.
When running ng build --prod --aot locally, it creates a my-app folder perfectly fine within the dist/ folder. Inside I have the expected mian,polyfills and runtime js files (with a hash value).
When running it in Azure DevOps (VSTS) it does not, only a out-tsc folder is created.
My angular.json
"projects": {
"my-app": {
"root": "",
"sourceRoot": "./ClientApp",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/my-app",
"index": "./ClientApp/index.html",
"main": "./ClientApp/main.ts",
"polyfills": "./ClientApp/polyfills.ts",
"tsConfig": "./ClientApp/tsconfig.app.json",
"assets": [
"./ClientApp/favicon.ico",
"./ClientApp/assets"
],
"styles": [
"./ClientApp/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "./ClientApp/environments/environment.ts",
"with": "./ClientApp/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
Running it locally:
PS C:\Users\USER\Source\Repos\MyProject\MyProject.MVC> npm run buildconfigprod --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli 'C:\\Users\\USER\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'run',
npm verb cli 'buildconfigprod',
npm verb cli '--verbose' ]
npm info using npm#6.4.0
npm info using node#v8.9.4
npm verb run-script [ 'prebuildconfigprod',
npm verb run-script 'buildconfigprod',
npm verb run-script 'postbuildconfigprod' ]
npm info lifecycle my-app#0.0.0~prebuildconfigprod: my-app#0.0.0
npm info lifecycle my-app#0.0.0~buildconfigprod: my-app#0.0.0
> my-app#0.0.0 buildconfigprod C:\Users\USER\Source\Repos\MyProject\MyProject.MVC
> ng build my-app --configuration production
Your global Angular CLI version (6.2.1) is greater than your local
version (6.1.5). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Date: 2018-10-16T12:45:26.931Z
Hash: fdf36103c4e08ff1c324
Time: 21386ms
chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
chunk {1} styles.a474c4b2064489e33e1b.css (styles) 0 bytes [initial] [rendered]
chunk {2} polyfills.001789666250e4564d51.js (polyfills) 59.6 kB [initial] [rendered]
chunk {3} main.aecca14d2a03e91e82ca.js (main) 660 kB [initial] [rendered]
npm verb lifecycle my-app#0.0.0~buildconfigprod: unsafe-perm in lifecycle true
npm verb lifecycle my-app#0.0.0~buildconfigprod: PATH: C:\Users\USER\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\USER\Source\Repos\MyProject\MyProject.MVC\node_modules\.bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\GnuPG\bin;C:\Program Files\SafeNet\Authentication\SAC\x64;C:\Program Files\SafeNet\Authentication\SAC\x32;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files\Git\cmd;C:\Users\USER\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\USER\AppData\Roaming\npm;C:\Users\USER\.dotnet\tools
npm verb lifecycle my-app#0.0.0~buildconfigprod: CWD: C:\Users\USER\Source\Repos\MyProject\MyProject.MVC
npm info lifecycle my-app#0.0.0~postbuildconfigprod: my-app#0.0.0
npm verb exit [ 0, true ]
npm timing npm Completed in 26723ms
npm info ok
Build config:
step 1 npm install:
step 2 npm run release:
where release has the following script command within package.json:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"release": "ng build --prod --aot",
"buildconfigprod": "ng build my-app --configuration production",
"runprod": "ng run my-app:build:production",
"e2e": "ng e2e"
},
So I have also tried different ways of running it, but no result so far.
Log file of Azure DevOps:
2018-10-16T12:43:06.5605572Z ##[section]Starting: npm build angular app MVC
2018-10-16T12:43:06.5611048Z ==============================================================================
2018-10-16T12:43:06.5611217Z Task : npm
2018-10-16T12:43:06.5611638Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
2018-10-16T12:43:06.5611811Z Version : 1.0.24
2018-10-16T12:43:06.5611948Z Author : Microsoft Corporation
2018-10-16T12:43:06.5612115Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
2018-10-16T12:43:06.5612281Z ==============================================================================
2018-10-16T12:43:07.1829249Z SYSTEMVSSCONNECTION exists true
2018-10-16T12:43:07.4015731Z SYSTEMVSSCONNECTION exists true
2018-10-16T12:43:07.4892005Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd --version"
2018-10-16T12:43:07.8349637Z 6.4.0
2018-10-16T12:43:08.6554123Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd config list"
2018-10-16T12:43:09.0251326Z ; cli configs
2018-10-16T12:43:09.0251779Z metrics-registry = "https://registry.npmjs.org/"
2018-10-16T12:43:09.0251984Z scope = ""
2018-10-16T12:43:09.0252178Z user-agent = "npm/6.4.0 node/v8.12.0 win32 x64"
2018-10-16T12:43:09.0252301Z
2018-10-16T12:43:09.0252479Z ; environment configs
2018-10-16T12:43:09.0252659Z cache = "C:\\npm\\cache"
2018-10-16T12:43:09.0252830Z loglevel = "verbose"
2018-10-16T12:43:09.0253434Z prefix = "C:\\npm\\prefix"
2018-10-16T12:43:09.0254273Z userconfig = "D:\\a\\1\\npm\\619.npmrc"
2018-10-16T12:43:09.0254488Z
2018-10-16T12:43:09.0254712Z ; builtin config undefined
2018-10-16T12:43:09.0254864Z
2018-10-16T12:43:09.0255099Z ; node bin location = C:\Program Files\nodejs\node.exe
2018-10-16T12:43:09.0255339Z ; cwd = D:\a\1\s\MyProject.MVC
2018-10-16T12:43:09.0255574Z ; HOME = C:\Users\VssAdministrator
2018-10-16T12:43:09.0255809Z ; "npm config ls -l" to show all defaults.
2018-10-16T12:43:09.0256006Z
2018-10-16T12:43:09.0257369Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd run release"
2018-10-16T12:43:09.0258780Z npm info it worked if it ends with ok
2018-10-16T12:43:09.0259425Z npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
2018-10-16T12:43:09.0259656Z npm verb cli 'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
2018-10-16T12:43:09.0259847Z npm verb cli 'config',
2018-10-16T12:43:09.0260037Z npm verb cli 'list' ]
2018-10-16T12:43:09.0260233Z npm info using npm#6.4.0
2018-10-16T12:43:09.0260415Z npm info using node#v8.12.0
2018-10-16T12:43:09.0260598Z npm verb exit [ 0, true ]
2018-10-16T12:43:09.0260766Z npm timing npm Completed in 58ms
2018-10-16T12:43:09.0260944Z npm info ok
2018-10-16T12:44:12.2488227Z npm info it worked if it ends with ok
2018-10-16T12:44:12.2488475Z
2018-10-16T12:44:12.2489256Z > my-app#0.0.0 release D:\a\1\s\MyProject.MVC
2018-10-16T12:44:12.2489977Z npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
2018-10-16T12:44:12.2490873Z npm verb cli 'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
2018-10-16T12:44:12.2491258Z npm verb cli 'run',
2018-10-16T12:44:12.2491522Z npm verb cli 'release' ]
2018-10-16T12:44:12.2491785Z npm info using npm#6.4.0
2018-10-16T12:44:12.2492045Z npm info using node#v8.12.0
2018-10-16T12:44:12.2492318Z npm verb run-script [ 'prerelease', 'release', 'postrelease' ]
2018-10-16T12:44:12.2492601Z npm info lifecycle my-app#0.0.0~prerelease: my-app#0.0.0
2018-10-16T12:44:12.2492905Z npm info lifecycle my-app#0.0.0~release: my-app#0.0.0
2018-10-16T12:44:12.2493192Z npm verb lifecycle my-app#0.0.0~release: unsafe-perm in lifecycle true
2018-10-16T12:44:12.2494714Z npm verb lifecycle my-app#0.0.0~release: PATH: C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\a\1\s\MyProject.MVC\node_modules\.bin;C:\hostedtoolcache\windows\NuGet\4.5.0\x64;C:\agents\2.140.2\externals\git\cmd;C:\tools\mingw64\bin;C:\Program Files\dotnet;C:\mysql-5.7.21-winx64\bin;C:\Program Files\Java\jdk1.8.0_181\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Ruby\2.5.0\x64\bin;C:\Go1.11\bin;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64;C:\Program Files\Microsoft MPI\Bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Chocolatey\bin;C:\Program Files\Docker;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\Git\cmd;C:\Program Files (x86)\Subversion\bin;C:\Program Files\nodejs\;C:\Program Files\CMake\bin;C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps
2018-10-16T12:44:12.2497292Z npm verb lifecycle my-app#0.0.0~release: CWD: D:\a\1\s\MyProject.MVC
2018-10-16T12:44:12.2497608Z npm info lifecycle my-app#0.0.0~postrelease: my-app#0.0.0
2018-10-16T12:44:12.2497897Z npm verb exit [ 0, true ]
2018-10-16T12:44:12.2498803Z npm timing npm Completed in 62897ms
2018-10-16T12:44:12.2499072Z npm info ok
2018-10-16T12:44:12.2499965Z > ng build --prod --aot
2018-10-16T12:44:12.2500240Z
2018-10-16T12:44:12.2500383Z
2018-10-16T12:44:12.2500635Z Date: 2018-10-16T12:44:12.131Z
2018-10-16T12:44:12.2500900Z Hash: fdf36103c4e08ff1c324
2018-10-16T12:44:12.2501151Z Time: 58602ms
2018-10-16T12:44:12.2501432Z chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
2018-10-16T12:44:12.2501739Z chunk {1} styles.a474c4b2064489e33e1b.css (styles) 0 bytes [initial] [rendered]
2018-10-16T12:44:12.2502068Z chunk {2} polyfills.001789666250e4564d51.js (polyfills) 59.6 kB [initial] [rendered]
2018-10-16T12:44:12.2502378Z chunk {3} main.aecca14d2a03e91e82ca.js (main) 660 kB [initial] [rendered]
2018-10-16T12:44:12.2630774Z ##[section]Finishing: npm build angular app MVC
Output artifacts as said only contains a dist/out-tsc folder and no dist/my-app folder.
The angular project is within an ASP.NET MVC 4.5 application, which is build after this is executed.
Also tried to install version 6.4.0 of NPM within the build definitions.
What am I doing wrong and wasting my day on?
EDIT:
I have this sequence:
I have diagnosed so far that the zip file does contain the valid files I am looking for! Hooray... So when the solution is build, it clears the dist/ file and then generates the out-tsc folder. That is not convenient. How can I keep these files in there? What is causing the .net build to clear the dist folder and generate the out-tsc files?
So I now need to find a way to keep the files in the dist folder during build. Doing it the other way around won't work because during the MVC Build I also turn it into a deploy package.
I have the following settings which is working fine as expected in all the environments.
No need to have "RunPostBuildEvent" or "PostBuildEvent" or "BeforeTargets" set up in csproj
No need to publish all files in project folder
Also build definition is created as in below with command link task.
I eventually solved this by changing the setting below, the default setting is "Only files needed to run this application". So it will remove node_modules and dist/my-app.
This will make sure that all files in the project folder will be pushed to the publish folder. It does has some drawbacks so I rather see another solution that will make sure that the node_modules folder and the dist/my-app folder are part of the application and needed to run the application.
I am new in Jenkins. I want run automatically my Protractor tests in Jenkins job.
This is my package.js file:
{
"name": "ui",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "5.2.0",
"#angular/common": "5.2.0",
"#angular/compiler": "5.2.0",
"#angular/core": "5.2.0",
"#angular/forms": "5.2.0",
"#angular/http": "5.2.11",
"#angular/platform-browser": "5.2.0",
"#angular/platform-browser-dynamic": "5.2.0",
"#angular/router": "5.2.0",
"bootstrap": "4.1.1",
"core-js": "2.4.1",
"jquery": "3.3.1",
"ngx-bootstrap": "^3.0.1",
"popper.js": "^1.14.3",
"protractor-jasmine2-html-reporter": "0.0.7",
"protractor-jasmine2-reporter": "^1.1.0",
"protractor-jasmine2-screenshot-reporter": "^0.5.0",
"rxjs": "5.5.6",
"zone.js": "0.8.19"
},
"devDependencies": {
"#angular/cli": "1.7.3",
"#angular/compiler-cli": "5.2.0",
"#angular/language-service": "5.2.0",
"#types/jasmine": "2.8.3",
"#types/jasminewd2": "2.0.2",
"#types/node": "6.0.60",
"codelyzer": "4.0.1",
"jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "2.0.2",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "1.2.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"protractor": "5.3.2",
"ts-node": "4.1.0",
"tslint": "5.9.1",
"typescript": "2.5.3"
}
}
This is my protractor.confing.js:
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
seleniumAddress: 'http://HubDomain-IP:4444/wd/hub',
//Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome',
// add node-name as applicationName where you have started node and wanted to remotely execute test cases
'applicationName': 'remoteNode'
},
chromeDriver: 'C:/Users/<username>/AppData/Roaming/npm/node_modules/protractor/selenium/chromedriver.exe',
seleniumServerJar: 'C:/Users/<username>/AppData/Roaming/npm/node_modules/protractor/selenium/selenium-server-standalone-2.40.0.jar',
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () { }
},
suites: {
full: 'e2e/**/**/*.ts',
powerMax200: 'e2e/tests/powerMax2000/*.ts',
powerMax200: 'e2e/tests/powerMax8000/*.ts',
vmax250f: 'e2e/tests/vmax250f/*.ts',
vmax950f: 'e2e/tests/vmax950f/*.ts'
},
onPrepare() {
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
require('ts-node').register({
// project: 'e2e/tsconfig.e2e.json',
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
savePath: './e2e/report',
screenshotsFolder: 'images'
}));
}
};
In my Jenkins job I pull code from BitBucket repository. And I execute Windows batch commands:
1) cd NewGenProject/ui/
npm install
2) cd NewGenProject/ui/
npm -g install protractor
3) cd NewGenProject/ui/
npm install -g #angular/cli
./node_modules.bin\webdriver-manager update
And i have error in console :
Started by user Admin
Building in workspace C:\Program Files (x86)\Jenkins\workspace\newGen_protractor
> C:\Program Files\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files\Git\bin\git.exe config remote.origin.url https://___somi#bitbucket.org/night_riders/desingstudio_new_gen.git # timeout=10
Fetching upstream changes from https://___somi#bitbucket.org/night_riders/desingstudio_new_gen.git
> C:\Program Files\Git\bin\git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> C:\Program Files\Git\bin\git.exe fetch --tags --progress https://___somi#bitbucket.org/night_riders/desingstudio_new_gen.git +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/application.properties
Seen branch in repository origin/develop
Seen branch in repository origin/master
Seen 3 remote branches
> C:\Program Files\Git\bin\git.exe show-ref --tags -d # timeout=10
Checking out Revision 4af5b739aa52943c28f58d128d5f28bffa095463 (origin/application.properties)
> C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Program Files\Git\bin\git.exe checkout -f 4af5b739aa52943c28f58d128d5f28bffa095463
Commit message: "a"
> C:\Program Files\Git\bin\git.exe rev-list --no-walk 4af5b739aa52943c28f58d128d5f28bffa095463 # timeout=10
System is not Unix, Xvfb will not be started
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins205557989357167568.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>npm install
npm WARN #angular/http#5.2.11 requires a peer of #angular/core#5.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN #angular/http#5.2.11 requires a peer of #angular/platform-browser#5.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-bootstrap#3.0.1 requires a peer of #angular/common#>=6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-bootstrap#3.0.1 requires a peer of #angular/core#>=6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
audited 7548 packages in 39.325s
found 8 vulnerabilities (2 low, 5 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins6721521287779075208.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>npm -g install protractor
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\protractor -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\protractor\bin\protractor
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\webdriver-manager -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
+ protractor#5.4.1
updated 1 package in 15.574s
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins3967655168792638034.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>npm install -g #angular/cli
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\ng -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\#angular\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ #angular/cli#6.2.2
updated 1 package in 41.598s
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins7519801179326584034.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>ng e2e --no-webdriver-update
Your global Angular CLI version (6.2.1) is greater than your local
version (1.7.3). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
** NG Live Development Server is listening on localhost:49156, open your browser on http://localhost:49156/ **
[0mDate: [1m[37m2018-09-18T11:33:38.940Z[39m[22m[0m
[0mHash: [1m[37mb824d4ffc831966e2310[39m[22m[0m
[0mTime: [1m[37m32450[39m[22mms[0m
[0mchunk {[1m[33minline[39m[22m} [1m[32minline.bundle.js, inline.bundle.js.map[39m[22m (inline) 3.89 kB [1m[33m[entry][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mmain[39m[22m} [1m[32mmain.bundle.js, main.bundle.js.map[39m[22m (main) 240 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mpolyfills[39m[22m} [1m[32mpolyfills.bundle.js, polyfills.bundle.js.map[39m[22m (polyfills) 203 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mscripts[39m[22m} [1m[32mscripts.bundle.js, scripts.bundle.js.map[39m[22m (scripts) 158 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mstyles[39m[22m} [1m[32mstyles.bundle.js, styles.bundle.js.map[39m[22m (styles) 158 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mvendor[39m[22m} [1m[32mvendor.bundle.js, vendor.bundle.js.map[39m[22m (vendor) 6.04 MB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
(node:3240) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
webpack: Compiled successfully.
[13:33:39] I/launcher - Running 1 instances of WebDriver
[13:33:39] I/direct - Using ChromeDriver directly...
[13:33:39] E/direct - Error code: 135
[13:33:39] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[13:33:39] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
at Direct.getNewDriver (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\protractor\built\driverProviders\direct.js:63:31)
at Runner.createBrowser (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\protractor\built\runner.js:195:43)
at q.then.then (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\protractor\built\runner.js:339:29)
at _fulfilled (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\q\q.js:796:13)
at C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\q\q.js:556:49
at runSingle (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\q\q.js:137:13)
at flush (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)
[13:33:39] E/launcher - Process exited with error code 135
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Change following 3 cmd lines in Jenkins job:
cd NewGenProject/ui/
npm install
node_moduels\.bin\ng e2e --webdriver-update