npm ERR!天蓝色devops中的代码ELIFECYCLE无法使其运行

路易斯·瓦伦西亚

我有一个带有2个npm任务的azure devops构建管道,一个npm安装一个npm run-script构建

但是我得到了这个错误,它没有提供足够的信息,问题出在哪里

##[section]Starting: npm run build
==============================================================================
Task         : npm
Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
Version      : 1.149.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
==============================================================================
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
[command]/usr/local/bin/npm --version
6.7.0
[command]/usr/local/bin/npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.7.0 node/v10.15.1 linux x64"

; environment configs
userconfig = "/home/vsts/work/1/npm/116.npmrc"

; node bin location = /usr/local/bin/node
; cwd = /home/vsts/work/1/s
; HOME = /home/vsts
; "npm config ls -l" to show all defaults.

[command]/usr/local/bin/npm run-script build
npm ERR! code ELIFECYCLE

npm ERR! errno 1
> [email protected] build /home/vsts/work/1/s
npm ERR! [email protected] build: `react-scripts-ts build`
> react-scripts-ts build
npm ERR! Exit status 1

npm ERR! 
Creating an optimized production build...
npm ERR! Failed at the [email protected] build script.
Starting type checking and linting service...
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Using ‌1 worker‌ with ‌2048MB‌ memory limit‌

ts-loader: Using [email protected] and /home/vsts/work/1/s/tsconfig.prod.json
npm ERR! A complete log of this run can be found in:
Failed to compile.
npm ERR!     /home/vsts/.npm/_logs/2019-04-02T06_09_24_119Z-debug.log

Module not found: Error: Can't resolve './languageProvider' in '/home/vsts/work/1/s/src'


Found npm debug log, make sure the path matches with the one in npm's output: /home/vsts/.npm/_logs/2019-04-02T06_09_24_119Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run-script',
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: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/vsts/work/1/s/node_modules/.bin:"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
9 verbose lifecycle [email protected]~build: CWD: /home/vsts/work/1/s
10 silly lifecycle [email protected]~build: Args: [ '-c', 'react-scripts-ts 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: `react-scripts-ts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/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> (/usr/local/lib/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 /home/vsts/work/1/s
16 verbose Linux 4.15.0-1037-azure
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run-script" "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: `react-scripts-ts 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

我的packages.json

{
  "name": "lulo",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "antd": "^3.15.1",
    "office-ui-fabric-react": "^6.157.1",
    "react": "^16.8.4",
    "react-adal": "^0.4.22",
    "react-dom": "^16.8.4",
    "react-intl": "^2.8.0",
    "react-scripts-ts": "3.1.0",
    "redux": "^4.0.1"
  },
  "scripts": {
    "start": "react-scripts-ts start",
    "build": "react-scripts-ts build",
    "test": "react-scripts-ts test --env=jsdom",
    "eject": "react-scripts-ts eject"
  },
  "devDependencies": {
    "@types/jest": "^24.0.11",
    "@types/node": "^11.11.4",
    "@types/react": "^16.8.8",
    "@types/react-adal": "^0.4.1",
    "@types/react-dom": "^16.8.2",
    "typescript": "^3.3.4000"
  }
}

和我的tsconfig.json

{
  "compilerOptions": {
      "paths": { "*": ["types/*"] },
    "baseUrl": ".",
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["es6", "dom"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDir": "src",
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "importHelpers": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true
  },
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "acceptance-tests",
    "webpack",
    "jest",
    "src/setupTests.ts"
  ]
}
尼诺·菲流

罪魁祸首在这里找到:

Module not found: Error: Can't resolve './languageProvider' in '/home/vsts/work/1/s/src'

确保此文件存在,并且可以通过解析react-scripts-ts build

提示是React构建脚本在后台使用Webpack,并webpack.config.js#resolve#extensions定义了Webpack要解析的扩展列表。确保其中包含src/languageProvider扩展名。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

尝试并发运行(npm ERR!代码 ELIFECYCLE npm ERR!)

npm ERR!运行npm install时的代码ELIFECYCLE

运行“ npm run build”后收到npm错误:npm ERR!代码ELIFECYCLE npm ERR!错误2

什么是npm ERR!代码ELIFECYCLE?

调试npm ERR!代码ELIFECYCLE npm ERR!errno 1

npm ERR!代码ELIFECYCLE(开始发行)

npm ERR!代码ELIFECYCLE npm后安装脚本

npm run build给出npm ERR!代码ELIFECYCLE

如何解决npm错误“ npm ERR!代码ELIFECYCLE”

我该如何解决'npm ERR!npm启动期间Project.js中的代码ELIFECYCLE'

npm ERR!代码ELIFECYCLE-无法启动开发服务器

如何解决节点服务器错误,npm ERR!代码ELIFECYCLE npm ERR!errno 1?

Npm ERR!代码EPERM

我启动npm时遇到了这个问题:npm ERR!代码ELIFECYCLE

如何解决 Linux 中的“npm ERR!code ELIFECYCLE”错误?

npm安装不起作用| npm ERR!路径 npm ERR!代码 npm ERR!errno | npm ERR!syscall | npm ERR!天生的

呃!运行npm start时输入代码ELIFECYCLE

npm 错误!代码 ENOLOCAL npm ERR!无法安装

如何解决错误:迁移MD5校验和失败[1] npm ERR!代码ELIFECYCLE npm ERR!errno 1

运行测试时出现npm error ELIFECYCLE

如何在天蓝色的Devops中安装Cobertura?

无法使用天蓝色图表中的代码获取应用程序的令牌

`npm install npm`给出gyp ERR和npm ERR

dotnet运行命令挂在天蓝色管道中

npm install会给出“ npm ERR!代码ENOTFOUND'错误

npm 错误!代码 ENOENT npm ERR!系统调用重命名

无法让bot从vs发行中以天蓝色工作

角度NPM运行产品:错误npm ERR!缺少脚本:产品

天蓝色的devops变量组