我正在尝试设置我的typescipt应用程序,但是当我尝试npm run build
时就失败了
节点v12.14.0
npm 6.13.4
大嘴CLI version: 2.2.0 Local version: 4.0.2
我的package.json
"name": "db-ts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "gulp scripts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-typescript": "^6.0.0-alpha.1",
"typescript": "^3.7.3"
}
}
我的gulpfile
const ts = require('gulp-typescript');
const JSON_FILES = ['src/*.json', 'src/**/*.json'];
// pull in the project TypeScript config
const tsProject = ts.createProject('tsconfig.json');
gulp.task('scripts', () => {
const tsResult = tsProject.src()
.pipe(tsProject());
return tsResult.js.pipe(gulp.dest('dist'));
});
gulp.task('watch', ['scripts'], () => {
gulp.watch('src/**/*.ts', ['scripts']);
});
gulp.task('assets', function() {
return gulp.src(JSON_FILES)
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['watch', 'assets']);
这是正在记录的内容:
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@6.13.4
3 info using node@v12.14.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle db-ts@1.0.0~prebuild: db-ts@1.0.0
6 info lifecycle db-ts@1.0.0~build: db-ts@1.0.0
7 verbose lifecycle db-ts@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle db-ts@1.0.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/darylbacon/Documents/Development/db-ts/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle db-ts@1.0.0~build: CWD: /Users/darylbacon/Documents/Development/db-ts
10 silly lifecycle db-ts@1.0.0~build: Args: [ '-c', 'gulp scripts' ]
11 silly lifecycle db-ts@1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle db-ts@1.0.0~build: Failed to exec build script
13 verbose stack Error: db-ts@1.0.0 build: `gulp scripts`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
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:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid db-ts@1.0.0
15 verbose cwd /Users/darylbacon/Documents/Development/db-ts
16 verbose Darwin 19.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v12.14.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error db-ts@1.0.0 build: `gulp scripts`
22 error Exit status 1
23 error Failed at the db-ts@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]