gpt4 book ai didi

node.js - Loopback 4 项目立即返回构建错误 (errno 2)

转载 作者:太空宇宙 更新时间:2023-11-03 23:16:43 25 4
gpt4 key购买 nike

尝试将 Loopback 用于新项目(以做出决定),在按照 the docs page 中提到的步骤操作后,我立即收到此错误:

Found 12 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! start@1.0.0 build: `tsc --outDir dist --target es2017`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the start@1.0.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! /Users/aa/.npm/_logs/2019-02-06T16_44_39_286Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! start@1.0.0 prepare: `npm run build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the start@1.0.0 prepare 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! /Users/aa/.npm/_logs/2019-02-06T16_44_39_349Z-debug.log

Application start was created in start.`

知道这是怎么回事以及如何解决它吗?

对于错误最后部分提到的日志,以下是其相关行:

7676 silly install start@1.0.0
7677 info lifecycle start@1.0.0~install: start@1.0.0
7678 silly postinstall start@1.0.0
7679 info lifecycle start@1.0.0~postinstall: start@1.0.0
7680 silly prepublish start@1.0.0
7681 info lifecycle start@1.0.0~prepublish: start@1.0.0
7682 info lifecycle start@1.0.0~prepare: start@1.0.0
7683 verbose lifecycle start@1.0.0~prepare: unsafe-perm in lifecycle true
7684 verbose lifecycle start@1.0.0~prepare: PATH: /Users/aa/.nvm/versions/node/v10.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/aa/Documents/loopback-test-app/trial/start/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/Users/aa/.nvm/versions/node/v10.14.1/bin:/Users/aa/go/bin:/data/mongo/bin:/Users/aa/Users/aa/npm/lib/node_modules/strapi:/Users/aa/.npm-packages/bin:/Users/g/Library/Haskell/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications:/usr/local/go/bin:/Applications/Postgres.app/Contents/Versions/latest/bin
7685 verbose lifecycle start@1.0.0~prepare: CWD: /Users/aa/Documents/loopback-test-app/trial/start
7686 silly lifecycle start@1.0.0~prepare: Args: [ '-c', 'npm run build' ]
7687 silly lifecycle start@1.0.0~prepare: Returned: code: 2 signal: null
7688 info lifecycle start@1.0.0~prepare: Failed to exec prepare script
7689 verbose stack Error: start@1.0.0 prepare: `npm run build`
7689 verbose stack Exit status 2
7689 verbose stack at EventEmitter.<anonymous> (/Users/aa/.nvm/versions/node/v10.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
7689 verbose stack at EventEmitter.emit (events.js:182:13)
7689 verbose stack at ChildProcess.<anonymous> (/Users/aa/.nvm/versions/node/v10.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
7689 verbose stack at ChildProcess.emit (events.js:182:13)
7689 verbose stack at maybeClose (internal/child_process.js:962:16)
7689 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
7690 verbose pkgid start@1.0.0
7691 verbose cwd /Users/aa/Documents/loopback-test-app/trial/start
7692 verbose Darwin 18.2.0
7693 verbose argv "/Users/aa/.nvm/versions/node/v10.14.1/bin/node" "/Users/aa/.nvm/versions/node/v10.14.1/bin/npm" "install" "--cache-min" "86400"
7694 verbose node v10.14.1
7695 verbose npm v6.4.1
7696 error code ELIFECYCLE
7697 error errno 2
7698 error start@1.0.0 prepare: `npm run build`
7698 error Exit status 2
7699 error Failed at the start@1.0.0 prepare script.
7699 error This is probably not a problem with npm. There is likely additional logging output above.
7700 verbose exit [ 2, true ]

最佳答案

事实证明,Loopback 4 由于未知原因没有安装 Typescript 所需的 Mocha 类型。我进入应用程序根文件夹并使用 npm install @types/mocha 安装它。现在可以了。

关于node.js - Loopback 4 项目立即返回构建错误 (errno 2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54558723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com