Reputation: 302
So I am trying to build and publish an angular.js app up to azure blob storage. I have the project building and I now need to run the bundling task to create an output that I want to publish up to blob storage, but when I run the task I get : npm ERR! missing script: D:\a\1\s/bundle.js
The build step in question is an NPM task and has this YAML :
- task: Npm@1
displayName: 'npm bundle'
inputs:
command: custom
workingDir: '$(System.DefaultWorkingDirectory)'
verbose: false
customCommand: 'run $(System.DefaultWorkingDirectory)/bundle.js'
Any idea how I do the bundling?
Here is the output from the task :
2021-05-24T18:56:12.9880011Z ##[section]Starting: npm bundle
2021-05-24T18:56:13.0035645Z ==============================================================================
2021-05-24T18:56:13.0036045Z Task : npm
2021-05-24T18:56:13.0036457Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
2021-05-24T18:56:13.0036887Z Version : 1.182.0
2021-05-24T18:56:13.0037154Z Author : Microsoft Corporation
2021-05-24T18:56:13.0037500Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/package/npm
2021-05-24T18:56:13.0038136Z ==============================================================================
2021-05-24T18:56:13.9312661Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\14.17.0\x64\npm.cmd --version"
2021-05-24T18:56:14.6978076Z 6.14.13
2021-05-24T18:56:16.3055204Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\14.17.0\x64\npm.cmd config list"
2021-05-24T18:56:17.0914358Z ; cli configs
2021-05-24T18:56:17.0915201Z metrics-registry = "https://registry.npmjs.org/"
2021-05-24T18:56:17.0915747Z scope = ""
2021-05-24T18:56:17.0916249Z user-agent = "npm/6.14.13 node/v14.17.0 win32 x64"
2021-05-24T18:56:17.0916554Z
2021-05-24T18:56:17.0916973Z ; environment configs
2021-05-24T18:56:17.0917440Z prefix = "C:\\npm\\prefix"
2021-05-24T18:56:17.0917914Z userconfig = "D:\\a\\1\\npm\\642.npmrc"
2021-05-24T18:56:17.0918226Z
2021-05-24T18:56:17.0918651Z ; globalconfig C:\npm\prefix\etc\npmrc
2021-05-24T18:56:17.0919191Z cache = "C:\\npm\\cache"
2021-05-24T18:56:17.0919472Z
2021-05-24T18:56:17.0919966Z ; node bin location = C:\hostedtoolcache\windows\node\14.17.0\x64\node.exe
2021-05-24T18:56:17.0920510Z ; cwd = D:\a\1\s
2021-05-24T18:56:17.0920984Z ; HOME = C:\Users\VssAdministrator
2021-05-24T18:56:17.0921466Z ; "npm config ls -l" to show all defaults.
2021-05-24T18:56:17.0921829Z
2021-05-24T18:56:17.0924582Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\14.17.0\x64\npm.cmd run bundle.js"
2021-05-24T18:56:17.9822327Z npm ERR! missing script: bundle.js
2021-05-24T18:56:17.9822972Z
2021-05-24T18:56:17.9823559Z npm ERR! A complete log of this run can be found in:
2021-05-24T18:56:17.9825738Z npm ERR! C:\npm\cache\_logs\2021-05-24T18_56_17_954Z-debug.log
2021-05-24T18:56:18.0311838Z Found npm debug log, make sure the path matches with the one in npm's output: C:\npm\cache\_logs\2021-05-24T18_56_17_954Z-debug.log
2021-05-24T18:56:18.0312533Z 0 info it worked if it ends with ok
2021-05-24T18:56:18.0312918Z 1 verbose cli [
2021-05-24T18:56:18.0313463Z 1 verbose cli 'C:\\hostedtoolcache\\windows\\node\\14.17.0\\x64\\node.exe',
2021-05-24T18:56:18.0314045Z 1 verbose cli 'C:\\hostedtoolcache\\windows\\node\\14.17.0\\x64\\node_modules\\npm\\bin\\npm-cli.js',
2021-05-24T18:56:18.0314505Z 1 verbose cli 'run',
2021-05-24T18:56:18.0314812Z 1 verbose cli 'bundle.js'
2021-05-24T18:56:18.0315127Z 1 verbose cli ]
2021-05-24T18:56:18.0315491Z 2 info using [email protected]
2021-05-24T18:56:18.0315798Z 3 info using [email protected]
2021-05-24T18:56:18.0316183Z 4 verbose stack Error: missing script: bundle.js
2021-05-24T18:56:18.0316777Z 4 verbose stack at run (C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\lib\run-script.js:155:19)
2021-05-24T18:56:18.0317478Z 4 verbose stack at C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\lib\run-script.js:63:5
2021-05-24T18:56:18.0318238Z 4 verbose stack at C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\node_modules\read-package-json\read-json.js:116:5
2021-05-24T18:56:18.0319056Z 4 verbose stack at C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\node_modules\read-package-json\read-json.js:436:5
2021-05-24T18:56:18.0319913Z 4 verbose stack at checkBinReferences_ (C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\node_modules\read-package-json\read-json.js:391:45)
2021-05-24T18:56:18.0322803Z 4 verbose stack at final (C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\node_modules\read-package-json\read-json.js:434:3)
2021-05-24T18:56:18.0323664Z 4 verbose stack at then (C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\node_modules\read-package-json\read-json.js:161:5)
2021-05-24T18:56:18.0324498Z 4 verbose stack at C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\node_modules\read-package-json\read-json.js:281:12
2021-05-24T18:56:18.0325369Z 4 verbose stack at C:\hostedtoolcache\windows\node\14.17.0\x64\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16
2021-05-24T18:56:18.0326349Z 4 verbose stack at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:73:3)
2021-05-24T18:56:18.0326818Z 5 verbose cwd D:\a\1\s
2021-05-24T18:56:18.0327158Z 6 verbose Windows_NT 10.0.17763
2021-05-24T18:56:18.0327803Z 7 verbose argv "C:\\hostedtoolcache\\windows\\node\\14.17.0\\x64\\node.exe" "C:\\hostedtoolcache\\windows\\node\\14.17.0\\x64\\node_modules\\npm\\bin\\npm-cli.js" "run" "bundle.js"
2021-05-24T18:56:18.0328421Z 8 verbose node v14.17.0
2021-05-24T18:56:18.0328745Z 9 verbose npm v6.14.13
2021-05-24T18:56:18.0329098Z 10 error missing script: bundle.js
2021-05-24T18:56:18.0329457Z 11 verbose exit [ 1, true ]
2021-05-24T18:56:18.0329605Z
2021-05-24T18:56:18.0372730Z ##[error]Error: Npm failed with return code: 1
2021-05-24T18:56:18.0394696Z ##[section]Finishing: npm bundle
Upvotes: 0
Views: 560
Reputation: 302
Ok so I changed the task type to a commandline task and just called node bundle.js :
steps:
- script: 'node bundle.js'
displayName: 'Bundle JS'
Upvotes: 0
Reputation: 35524
Based on your latest comment, the bundle.js file is valid.
You could try the following steps to run js file with NPM Task.
Example:
{
"name": "webpackguide",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server",
"bundle":"node bundle.js"
},
....
Example:
- task: Npm@1
displayName: 'npm custom'
inputs:
command: custom
workingDir: '$(System.DefaultWorkingDirectory)'
verbose: false
customCommand: 'run bundle'
Upvotes: 1