我刚刚将我的webpack配置更新为angular2-webpack-starterkit中的新版本,但现在我的构建在节点模块中抛出以下奇怪错误。 我用这个; 节点v4.4.7 npm v3.10.5 窗口10 64位
mypath\node_modules\webpack\lib\LibManifestPlugin.js:46
var content = Buffer.from(JSON.stringify(manifest, null, 2), "utf8");
^
TypeError: utf8 is not a function
at Function.from (native)
at Function.from (native)
at LibManifestPlugin.<anonymous> (mypath\node_modules\webpack\lib\LibManifestPlugin.js:46:25)
at mypath\node_modules\webpack\node_modules\async\dist\async.js:3025:16
at eachOfArrayLike (mypath\node_modules\webpack\node_modules\async\dist\async.js:941:9)
at eachOf (mypath\node_modules\webpack\node_modules\async\dist\async.js:991:5)
at Object.eachLimit (mypath\node_modules\webpack\node_modules\async\dist\async.js:3089:3)
at LibManifestPlugin.<anonymous> (mypath\node_modules\webpack\lib\LibManifestPlugin.js:14:9)
at Compiler.applyPluginsAsyncSeries (mypath\node_modules\tapable\lib\Tapable.js:142:13)
at Compiler.emitAssets (mypath\node_modules\webpack\lib\Compiler.js:292:7)
at onCompiled (mypath\node_modules\webpack\lib\Compiler.js:231:11)
at mypath\node_modules\webpack\lib\Compiler.js:477:13
at next (mypath\node_modules\tapable\lib\Tapable.js:138:11)
at Compiler.<anonymous> (mypath\node_modules\webpack\lib\CachePlugin.js:62:5)
at Compiler.applyPluginsAsyncSeries (mypath\node_modules\tapable\lib\Tapable.js:142:13)
at mypath\node_modules\webpack\lib\Compiler.js:474:10
at Compilation.applyPluginsAsyncSeries (mypath\node_modules\tapable\lib\Tapable.js:131:46)
at mypath\node_modules\webpack\lib\Compilation.js:615:19
at Compilation.applyPluginsAsyncSeries (mypath\node_modules\tapable\lib\Tapable.js:131:46)
at mypath\node_modules\webpack\lib\Compilation.js:606:11
at Compilation.applyPluginsAsyncSeries (mypath\node_modules\tapable\lib\Tapable.js:131:46)
at mypath\node_modules\webpack\lib\Compilation.js:601:10
at Compilation.applyPluginsAsyncSeries (mypath\node_modules\tapable\lib\Tapable.js:131:46)
at sealPart2 (mypath\node_modules\webpack\lib\Compilation.js:597:9)
at Compilation.applyPluginsAsyncSeries (mypath\node_modules\tapable\lib\Tapable.js:131:46)
at Compilation.seal (mypath\node_modules\webpack\lib\Compilation.js:545:8)
at mypath\node_modules\webpack\lib\Compiler.js:471:16
at mypath\node_modules\tapable\lib\Tapable.js:225:11
at mypath\node_modules\webpack\lib\Compilation.js:452:11
at mypath\node_modules\webpack\lib\Compilation.js:423:13
这是我的package.config:
{
"name": "myApp",
"version": "1.0.0",
"scripts": {
"build:aot:prod": "npm run clean:dist && npm run clean:aot && webpack --config config/webpack.prod.js --progress --profile --bail",
"build:aot": "npm run build:aot:prod",
"build:dev": "npm run clean:dist && webpack --config config/webpack.dev.js --progress --profile",
"build:docker": "npm run build:prod && docker build -t angular2-webpack-start:latest .",
"build:prod": "npm run clean:dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"build": "npm run build:dev",
"ci:aot": "npm run lint && npm run test && npm run build:aot && npm run e2e",
"ci:jit": "npm run lint && npm run test && npm run build:prod && npm run e2e",
"ci:nobuild": "npm run lint && npm test && npm run e2e",
"ci:testall": "npm run lint && npm run test && npm run build:prod && npm run e2e && npm run build:aot && npm run e2e",
"ci:travis": "npm run lint && npm run test && npm run build:dev && npm run e2e:travis && npm run build:prod && npm run e2e:travis && npm run build:aot && npm run e2e:travis",
"ci": "npm run ci:testall",
"clean:dll": "npm run rimraf -- dll",
"clean:aot": "npm run rimraf -- compiled",
"clean:dist": "npm run rimraf -- dist",
"clean:install": "npm set progress=false && npm install",
"clean": "npm cache clean && npm run rimraf -- node_modules doc coverage dist compiled dll",
"docker": "docker",
"docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/",
"e2e:live": "npm-run-all -p -r server:prod:ci protractor:live",
"e2e:travis": "npm-run-all -p -r server:prod:ci protractor:delay",
"e2e": "npm-run-all -p -r server:prod:ci protractor",
"github-deploy:dev": "webpack --config config/webpack.github-deploy.js --progress --profile --env.githubDev",
"github-deploy:prod": "webpack --config config/webpack.github-deploy.js --progress --profile --env.githubProd",
"github-deploy": "npm run github-deploy:dev",
"lint": "npm run tslint \"src/**/*.ts\"",
"postinstall": "npm run webdriver:update",
"postversion": "git push && git push --tags",
"preclean:install": "npm run clean",
"preversion": "npm test",
"protractor": "protractor",
"protractor:delay": "sleep 3 && npm run protractor",
"protractor:live": "protractor --elementExplorer",
"rimraf": "rimraf",
"server:dev:hmr": "npm run server:dev -- --inline --hot",
"server:dev": "webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/",
"server:prod": "http-server dist -c-1 --cors",
"server:prod:ci": "http-server dist -p 3000 -c-1 --cors",
"server": "npm run server:dev",
"start:hmr": "npm run server:dev:hmr",
"start": "npm run server:dev",
"test": "npm run lint && karma start",
"tslint": "tslint",
"typedoc": "typedoc",
"version": "npm run build",
"watch:dev:hmr": "npm run watch:dev -- --hot",
"watch:dev": "npm run build:dev -- --watch",
"watch:prod": "npm run build:prod -- --watch",
"watch:test": "npm run test -- --auto-watch --no-single-run",
"watch": "npm run watch:dev",
"webdriver-manager": "webdriver-manager",
"webdriver:start": "npm run webdriver-manager start",
"webdriver:update": "webdriver-manager update",
"webpack-dev-server": "webpack-dev-server",
"webpack": "webpack"
},
"license": "ISC",
"dependencies": {
"@angular/common": "~2.4.3",
"@angular/compiler": "~2.4.3",
"@angular/core": "~2.4.3",
"@angular/forms": "~2.4.3",
"@angular/http": "~2.4.3",
"@angular/platform-browser": "~2.4.3",
"@angular/platform-browser-dynamic": "~2.4.3",
"@angular/router": "~3.4.3",
"@angular/upgrade": "~2.4.3",
"@angularclass/conventions-loader": "^1.0.2",
"@angularclass/hmr": "~1.2.2",
"@angularclass/hmr-loader": "~3.0.2",
"assets-webpack-plugin": "^3.4.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"http-server": "^0.9.0",
"ie-shim": "^0.1.0",
"jquery": "^2.2.3",
"reflect-metadata": "^0.1.8",
"rxjs": "~5.0.2",
"zone.js": "~0.7.4"
},
"devDependencies": {
"@angular/compiler-cli": "~2.4.3",
"@types/hammerjs": "^2.0.33",
"@types/jasmine": "^2.2.34",
"@types/node": "^7.0.0",
"@types/selenium-webdriver": "~2.53.39",
"@types/source-map": "^0.5.0",
"@types/uglify-js": "^2.0.27",
"@types/webpack": "^2.0.0",
"add-asset-html-webpack-plugin": "^1.0.2",
"angular2-template-loader": "^0.6.0",
"assets-webpack-plugin": "^3.4.0",
"awesome-typescript-loader": "~3.0.0-beta.17",
"codelyzer": "~2.0.0-beta.4",
"copy-webpack-plugin": "^4.0.0",
"css-loader": "^0.26.0",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "~2.0.0-beta.4",
"file-loader": "^0.9.0",
"find-root": "^1.0.0",
"gh-pages": "^0.12.0",
"html-webpack-plugin": "^2.21.0",
"imports-loader": "^0.7.0",
"istanbul-instrumenter-loader": "1.2.0",
"jasmine-core": "^2.5.2",
"json-loader": "^0.5.4",
"karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.0.2",
"karma-mocha-reporter": "^2.0.0",
"karma-remap-coverage": "^0.1.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "2.0.1",
"ng-router-loader": "^1.0.2",
"ngc-webpack": "1.1.0",
"node-sass": "^4.2.0",
"npm-run-all": "^4.0.0",
"parse5": "^3.0.1",
"protractor": "^4.0.14",
"raw-loader": "0.5.1",
"rimraf": "~2.5.4",
"sass-loader": "^4.1.1",
"script-ext-html-webpack-plugin": "^1.3.2",
"source-map-loader": "^0.1.5",
"string-replace-loader": "1.0.5",
"style-loader": "^0.13.1",
"to-string-loader": "^1.1.4",
"ts-helpers": "1.1.2",
"ts-node": "^2.0.0",
"tslint": "~4.3.1",
"typedoc": "^0.5.3",
"typescript": "~2.1.4",
"url-loader": "^0.5.7",
"v8-lazy-parse-webpack-plugin": "^0.3.0",
"webpack": "2.2.0-rc.4",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "2.2.0-rc.0",
"webpack-dll-bundles-plugin": "^1.0.0-beta.2",
"webpack-md5-hash": "^0.0.5",
"webpack-merge": "~2.3.1"
}
}
#UPDATE# 现在尝试克隆starterkit并运行具有相同错误的npm run build:dev任务。也许这是一个错误
答案 0 :(得分:1)
通过将节点版本更改为6.9.4 https://github.com/AngularClass/angular2-webpack-starter/issues/1372
来解决此问题