运行节点命令错误的vscode任务

时间:2018-04-13 18:20:47

标签: npm configuration visual-studio-code

我可以在cmd中运行npm命令,但是在vscode任务上运行npm会出现错误:

> Executing task: npm run start <


> ngauction@0.0.0 start f:\work\ngauction
> ng serve

Path "f:/work/ngauction" must be absolute.
Error: Path "f:/work/ngauction" must be absolute.
at Object.relative (f:\work\ngauction\node_modules\@angular-devkit\core\src\virtual-fs\path.js:112:15)
at isInside (f:\work\ngauction\node_modules\@angular\cli\utilities\config.js:115:42)
at workspace.listProjectNames.map.sort (f:\work\ngauction\node_modules\@angular\cli\utilities\config.js:123:25)
at Array.sort (native)
at getProjectByCwd (f:\work\ngauction\node_modules\@angular\cli\utilities\config.js:123:10)
at Object.isWarningEnabled (f:\work\ngauction\node_modules\@angular\cli\utilities\config.js:230:25)
at Function.assertTypescriptVersion (f:\work\ngauction\node_modules\@angular\cli\upgrade\version.js:111:23)
at ServeCommand.validate (f:\work\ngauction\node_modules\@angular\cli\commands\serve.js:29:27)
at f:\work\ngauction\node_modules\@angular\cli\models\command-runner.js:274:39
at Generator.next (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ngauction@0.0.0 start: `ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ngauction@0.0.0 start 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\sheng\AppData\Roaming\npm-cache\_logs\2018-04-13T17_59_47_695Z-debug.log
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it. 

但是cmd命令行运行正常。

F:\work\ngauction>npm start

> ngauction@0.0.0 start F:\work\ngauction
> ng serve

** Angular Live Development Server is listening on localhost: 4200, open your browser on http://localhost:4200/ **

Date: 2018-04-13T18:17:45.826Z
Hash: 0f46eedd59b6b8e4a698
Time: 8900ms
chunk {main} main.js, main.js.map (main) 11.2 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 226 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.09 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 394 kB  [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.2 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.72 MB [initial] [rendered]
i 「wdm」: Compiled successfully.

cmd命令行和任务之间有什么区别。如何使任务正确运行?

0 个答案:

没有答案