大家。我无法通过npm run dev
命令运行任何vue js项目
我试图以多种方式解决它:
即使在新鲜的vue项目中npm run dev
也无效。任何人都可以帮助我吗?
这是我的日志:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Mat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using npm@5.6.0
3 info using node@v8.9.4
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle testvue@1.0.0~predev: testvue@1.0.0
6 info lifecycle testvue@1.0.0~dev: testvue@1.0.0
7 verbose lifecycle testvue@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle testvue@1.0.0~dev: PATH: C:\Users\Mat\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\www\testvue\node_modules\.bin;C:\PROGRA~2\Borland\CBUILD~1\Bin;C:\PROGRA~2\Borland\CBUILD~1\Projects\Bpl;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files (x86)\HP SimplePass 2011\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\nodejs\;C:\Program Files\Microsoft VS Code\bin;C:\Users\Mat\AppData\Roaming\Composer\vendor\bin;C:\Users\Mat\AppData\Local\atom\bin;C:\Users\Mat\AppData\Roaming\npm
9 verbose lifecycle testvue@1.0.0~dev: CWD: C:\www\testvue
10 silly lifecycle testvue@1.0.0~dev: Args: [ '/d /s /c',
10 silly lifecycle 'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js' ]
11 silly lifecycle testvue@1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle testvue@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: testvue@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Mat\AppData\Roaming\npm\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:\Users\Mat\AppData\Roaming\npm\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 testvue@1.0.0
15 verbose cwd C:\www\testvue
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error testvue@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
22 error Exit status 1
23 error Failed at the testvue@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
答案 0 :(得分:0)
我没有弄清楚如何修复npm run dev
,但我尝试了纱线。
$ npm install -g yarn
$ vue init webpack
-> Should we run npm install for you after the project has been created? (recommended) `yarn`
$ yarn run dev
这解决了我的问题,我可以通过yarn run dev
运行我的项目。