我是使用vuejs和dotnet核心的新手 我使用https://github.com/MarkPieszak/aspnetcore-Vue-starter
中的aspnetcore-Vue-starter-master模板构建应用程序我使用node-js 5.6.0,dotnet 2.1.300
我的packege.json
{
"name": "aspnetcore-vuejs",
"description": "ASP.NET Core Holiday",
"author": "moein elwani",
"repository": {
"url": "https://github.com/MarkPieszak/aspnetcore-Vue-starter"
},
"license": "MIT",
"scripts": {
"dev": "cross-env ASPNETCORE_ENVIRONMENT=Development NODE_ENV=development dotnet run",
"build": "npm run build-vendor:prod && npm run build:prod",
"build:prod": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"build-vendor:prod": "cross-env NODE_ENV=production webpack --config webpack.config.vendor.js --progress",
"build-vendor:dev": "cross-env NODE_ENV=development webpack --config webpack.config.vendor.js --progress",
"lint": "eslint -c ./.eslintrc.js ClientApp/**/*.js ClientApp/**/*.vue ClientApp/**/*.json webpack*.js",
"install": "npm run build-vendor:dev"
},
"dependencies": {
"@xkeshi/vue-qrcode": "^0.3.0",
"axios": "^0.15.3",
"vue-barcode-scanner": "^0.6.0",
"bootstrap-vue": "^2.0.0-rc.10",
"core-js": "^2.5.3",
"moment": "^2.22.1",
"vue": "^2.5.16",
"vue-blockui": "^1.1.7",
"vue-date-format": "^1.1.2",
"vue-moment": "^4.0.0-0",
"vue-router": "^2.8.1",
"vue-server-renderer": "^2.5.16",
"vue-template-compiler": "^2.5.16",
"vuex": "^2.5.0",
"vuex-router-sync": "^4.3.2",
"webpack-dev-server": "^2.9.1"
},
"devDependencies": {
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-free-brands": "^5.0.8",
"@fortawesome/fontawesome-free-solid": "^5.0.8",
"@fortawesome/vue-fontawesome": "0.0.22",
"aspnet-webpack": "^2.0.3",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^6.4.1",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.26.0",
"bootstrap": "^4.0.0",
"cross-env": "^3.2.4",
"css-loader": "^0.26.4",
"eslint": "^4.18.2",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-html": "^4.0.2",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"event-source-polyfill": "0.0.7",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.9.0",
"font-awesome": "^4.7.0",
"jquery": "^2.2.4",
"node-sass": "^4.8.2",
"optimize-css-assets-webpack-plugin": "^1.3.2",
"popper.js": "^1.14.1",
"sass-loader": "^4.1.1",
"style-loader": "^0.13.2",
"url-loader": "^0.5.9",
"vue-loader": "^14.2.2",
"webpack": "^2.7.0",
"webpack-hot-middleware": "^2.21.2"
}
}
的web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
我的app.js
import Vue from 'vue'
import axios from 'axios'
import router from './router/index'
import store from './store'
import { sync } from 'vuex-router-sync'
import App from 'components/app-root'
import { FontAwesomeIcon } from './icons'
import BootstrapVue from 'bootstrap-vue'
import BlockUI from 'vue-blockui'
//import Moment from 'moment'
import VueQrcode from '@xkeshi/vue-qrcode'
import vueDateFormat from 'vue-date-format'
//import VueBarcodeScanner from 'vue-barcode-scanner'
Vue.use(vueDateFormat)
Vue.component('qrcode', VueQrcode);
Vue.component('icon', FontAwesomeIcon)
Vue.use(BootstrapVue);
Vue.use(BlockUI)
//Vue.use(Moment);
Vue.prototype.$http = axios
sync(store, router)
const app = new Vue({
store,
router,
...App
})
export {
app,
router,
store
}
应用程序建立并成功完成 但是从'vue-barcode-scanner'导入VueBarcodeScanner时 并尝试运行npm bulid我得到此错误
88% [0] chunk assets processing 89% [0] additional chunk assets processing
90% [0] recording 91% [0] additional
asset processing 92% [0] chunk asset optimization 94% [0]
asset optimization 95% [0] emitting [0] npm ERR! code
ELIFECYCLE
At line:1 char:1
+ npm run build
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( 0% [0] compil...code ELIFECYCLE:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
npm ERR! errno 2
npm ERR! aspnetcore-vuejs@ build:prod: `cross-env NODE_ENV=production webpack --progress --hide-modules`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the aspnetcore-vuejs@ build:prod 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! C:\Users\user\AppData\Roaming\npm-cache\_logs\2018-06-10T22_13_37_473Z-debug.log
npm
ERR!
code
ELIFECYCLE
npm
ERR!
errno
2
npm
ERR! aspnetcore-vuejs@ build: `npm run build-vendor:prod && npm run build:prod`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the aspnetcore-vuejs@ 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! C:\Users\user\AppData\Roaming\npm-cache\_logs\2018-06-10T22_13_37_507Z-debug.log
档案日志
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm@5.6.0
3 info using node@v8.9.4
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle aspnetcore-vuejs@~prebuild: aspnetcore-vuejs@
6 info lifecycle aspnetcore-vuejs@~build: aspnetcore-vuejs@
7 verbose lifecycle aspnetcore-vuejs@~build: unsafe-perm in lifecycle true
8 verbose lifecycle aspnetcore-vuejs@~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;G:\app\6-5\modelin\aspnetcore-Vue-starter-master\content\node_modules\.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_162\bin;C:\Android\android-sdk\tools;C:\Android\android-sdk\platform-tools;C:\Program Files\Dell\Dell Data Protection\Drivers\TSS\bin\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\dotnet\;C:\Program Files\Git\cmd;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\user\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin;C:\Users\user\.dotnet\tools;C:\Users\user\.nuget\packages\newtonsoft.json\10.0.1\tools;C:\Users\user\.nuget\packages\microsoft.entityframeworkcore.tools\2.1.0\tools;C:\Users\user\.nuget\packages\microsoft.codeanalysis.analyzers\1.1.0\tools
9 verbose lifecycle aspnetcore-vuejs@~build: CWD: G:\app\6-5\modelin\aspnetcore-Vue-starter-master\content
10 silly lifecycle aspnetcore-vuejs@~build: Args: [ '/d /s /c',
10 silly lifecycle 'npm run build-vendor:prod && npm run build:prod' ]
11 silly lifecycle aspnetcore-vuejs@~build: Returned: code: 2 signal: null
12 info lifecycle aspnetcore-vuejs@~build: Failed to exec build script
13 verbose stack Error: aspnetcore-vuejs@ build: `npm run build-vendor:prod && npm run build:prod`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid aspnetcore-vuejs@
15 verbose cwd G:\app\6-5\modelin\aspnetcore-Vue-starter-master\content
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 2
22 error aspnetcore-vuejs@ build: `npm run build-vendor:prod && npm run build:prod`
22 error Exit status 2
23 error Failed at the aspnetcore-vuejs@ build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
最近我在尝试使用时出现此错误 //Vue.use(Moment)and puplish app,但我使用'vue-date-format'库而不是