gpt4 book ai didi

npm - Browserify 任务错误

转载 作者:行者123 更新时间:2023-12-04 10:09:20 25 4
gpt4 key购买 nike

刚开始使用 gulp 不久前,当我遇到这个错误时,一切正常。我试过了

//gulpfile.js
var gulp = require('gulp'),
browserify = require('browserify'),
source = require('vinyl-source-stream');

// Browserify task
gulp.task('browserify', function() {
return browserify(['app/scripts/app.js'], {debug:true})
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('dist/scripts'))
});

运行 gulp browserify 时出错

events.js:141
throw er; // Unhandled 'error' event
^
SyntaxError: Unterminated string constant

这个语法错误指向哪里?我也阅读了一些关于 package.json 文件中的错误的文章。

"devDependencies": {
"browserify": "^13.0.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-clean-css": "^2.0.4",
"gulp-connect": "^3.2.1",
"gulp-imagemin": "^2.4.0",
"gulp-less": "^3.0.5",
"gulp-plumber": "^1.1.0",
"gulp-uglify": "^1.5.3",
"vinyl-source-stream": "^1.1.0"
},
"dependencies": {
"angular": "^1.5.3",
"imagemin-pngquant": "^4.2.2"
}


//browserify package.json
{
"name": "browserify",
"version": "13.0.0",
"description": "browser-side require() the node way",
"main": "index.js",
"bin": {
"browserify": "bin/cmd.js"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/substack/node-browserify.git"
},
"keywords": [
"browser",
"require",
"commonjs",
"commonj-esque",
"bundle",
"npm",
"javascript"
],
"dependencies": {
"JSONStream": "^1.0.3",
"assert": "~1.3.0",
"browser-pack": "^6.0.1",
"browser-resolve": "^1.11.0",
"browserify-zlib": "~0.1.2",
"buffer": "^4.1.0",
"concat-stream": "~1.5.1",
"console-browserify": "^1.1.0",
"constants-browserify": "~1.0.0",
"crypto-browserify": "^3.0.0",
"defined": "^1.0.0",
"deps-sort": "^2.0.0",
"domain-browser": "~1.1.0",
"duplexer2": "~0.1.2",
"events": "~1.1.0",
"glob": "^5.0.15",
"has": "^1.0.0",
"htmlescape": "^1.1.0",
"stream-http": "^2.0.0",
"https-browserify": "~0.0.0",
"inherits": "~2.0.1",
"insert-module-globals": "^7.0.0",
"isarray": "0.0.1",
"labeled-stream-splicer": "^2.0.0",
"module-deps": "^4.0.2",
"os-browserify": "~0.1.1",
"parents": "^1.0.1",
"path-browserify": "~0.0.0",
"process": "~0.11.0",
"punycode": "^1.3.2",
"querystring-es3": "~0.2.0",
"read-only-stream": "^2.0.0",
"readable-stream": "^2.0.2",
"resolve": "^1.1.4",
"shasum": "^1.0.0",
"shell-quote": "^1.4.3",
"stream-browserify": "^2.0.0",
"string_decoder": "~0.10.0",
"subarg": "^1.0.0",
"syntax-error": "^1.1.1",
"through2": "^2.0.0",
"timers-browserify": "^1.0.1",
"tty-browserify": "~0.0.0",
"url": "~0.11.0",
"util": "~0.10.1",
"vm-browserify": "~0.0.1",
"xtend": "^4.0.0"
},
"devDependencies": {
"backbone": "~0.9.2",
"browser-unpack": "^1.1.1",
"coffee-script": "~1.10.0",
"coffeeify": "~1.1.0",
"es6ify": "~0.4.8",
"isstream": "^0.1.2",
"seq": "0.3.5",
"tap": "^2.2.0",
"temp": "^0.8.1",
"through": "^2.3.4"
},
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"scripts": {
"test": "tap test/*.js"
},
"license": "MIT",
"gitHead": "5b82a2f1bc061cb47ff4aa7c702ed79fc20effa8",
"bugs": {
"url": "https://github.com/substack/node-browserify/issues"
},
"homepage": "https://github.com/substack/node-browserify#readme",
"_id": "browserify@13.0.0",
"_shasum": "8f223bb24ff4ee4335e6bea9671de294e43ba6a3",
"_from": "browserify@latest",
"_npmVersion": "2.14.7",
"_nodeVersion": "4.2.3",
"_npmUser": {
"name": "feross",
"email": "feross@feross.org"
},
"dist": {
"shasum": "8f223bb24ff4ee4335e6bea9671de294e43ba6a3",
"tarball": "http://registry.npmjs.org/browserify/-/browserify- 13.0.0.tgz"
},
"maintainers": [
{
"name": "domenic",
"email": "d@domenic.me"
},
{
"name": "dominictarr",
"email": "dominic.tarr@gmail.com"
},
{
"name": "feross",
"email": "feross@feross.org"
},
{
"name": "jmm",
"email": "npm-public@jessemccarthy.net"
},
{
"name": "mafintosh",
"email": "mathiasbuus@gmail.com"
},
{
"name": "maxogden",
"email": "max@maxogden.com"
},
{
"name": "mellowmelon",
"email": "palmermebane@gmail.com"
},
{
"name": "substack",
"email": "substack@gmail.com"
},
{
"name": "terinjokes",
"email": "terinjokes@gmail.com"
},
{
"name": "thlorenz",
"email": "thlorenz@gmx.de"
},
{
"name": "zertosh",
"email": "zertosh@gmail.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/browserify/-/browserify-13.0.0.tgz",
"readme": "ERROR: No README data found!"
}

最佳答案

我设法通过添加

来运行它而没有错误
{
"devDependencies": {
"browserify": "^13.0.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-clean-css": "^2.0.4",
"gulp-connect": "^3.2.1",
"gulp-imagemin": "^2.4.0",
"gulp-less": "^3.0.5",
"gulp-plumber": "^1.1.0",
"gulp-uglify": "^1.5.3",
"vinyl-source-stream": "^1.1.0"
},
"dependencies": {
"angular": "^1.5.3",
"imagemin-pngquant": "^4.2.2"
},
//Tells browserify to use browserify-shim
"browserify": {
"transform": [ "browserify-shim" ]
},
"browserify-shim": {
"./app/scripts/app.js": "$"
}
}

关于npm - Browserify 任务错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36368416/

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