1

I have a Vue project which compiles just fine on my machine. Today, I went and started its deploy setup on the Azure DevOps platform, which seems to run ok until "npm run build" is called. From there, I receive multiple "ELIFECYCLE" errors, what doesn't help me much. What I've tried so far:

  • Tried deleting both node_modules and package-lock.json with npm clean cache and using cmd delete remove command
  • Tried on a Linux and Windows production machines

What am I missing here?

[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd run build"
-  Building for production...

 ERROR  Build failed with errors.
> [email protected] build D:\_work\1\s
npm ERR! code ELIFECYCLE
> vue-cli-service build
npm ERR! errno 1

npm ERR! [email protected] build: `vue-cli-service build`

npm ERR! Exit status 1
 ERROR  Failed to compile with 1 errors9:12:59 PM
npm ERR! 

npm ERR! Failed at the [email protected] build script.
This relative module was not found:
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


* ./Router in ./src/main.js
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\npm\cache\_logs\2019-02-26T21_13_00_370Z-debug.log
Found npm debug log, make sure the path matches with the one in npm's output: C:\npm\cache\_logs\2019-02-26T21_13_00_370Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\_work\1\s\node_modules\.bin;C:\agents\2.147.1\externals\git\cmd;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\dotnet;C:\npm\prefix;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\ProgramData\Chocolatey\bin;C:\Users\packer\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Docker;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Subversion\bin;C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps
9 verbose lifecycle [email protected]~build: CWD: D:\_work\1\s
10 silly lifecycle [email protected]~build: Args: [ '/d /s /c', 'vue-cli-service build' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `vue-cli-service build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd D:\_work\1\s
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.15.1
19 verbose npm  v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

##[error]Error: Npm failed with return code: 1
##[section]Finishing: npm run build
1
  • Did you ever find a solution? Commented Apr 8, 2019 at 13:31

2 Answers 2

1

while not a direct answer to your question, when dealing with node on Azure DevOps hosted agents I found that I do get some random errors, so I switched to using a container to build those (inside hosted agents) and all my errors went away:

jobs:
  - job: build_server
    pool:
      vmImage: 'Ubuntu-16.04'
    steps:
    # build
    - script: |
        docker run -v $(Build.SourcesDirectory):/npm node:10.15 bash \
          -c "cd /npm && npm install && npm run web-build"

    # package
    - task: Docker@1
      inputs:
        containerregistrytype: 'Container Registry'
        dockerRegistryEndpoint: ${{ parameters.registryName }}
        imageName: ${{ format('clarity2/{0}/$(Build.SourceBranchName):$(Build.BuildNumber)', parameters.solutionName) }}
        includeLatestTag: true
        dockerFile: dockerfile
    - task: Docker@1
      inputs:
        containerregistrytype: 'Container Registry'
        dockerRegistryEndpoint: ${{ parameters.registryName }}
        imageName: ${{ format('clarity2/{0}/$(Build.SourceBranchName)', parameters.solutionName) }}
        command: push
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the help! It's hard to track those logs in DevOps, I might use your solution someday
0

In the end, it was a case matter under "./Router". On a closer look, the log stated that:

This relative module was not found:
* ./Router in ./src/main.js

The first problem here is that these lines were NOT following each other on the log file, so hard to interpret.

On my machine, "./Router" was correctly named, but on the repo it had a lower case, which confused the build process. Hard to track, though.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.