当前工作目录不是基于Cordova的项目

时间:2018-11-28 15:58:53

标签: angular windows cordova ionic-framework ionic4

在Ionic4项目的根目录中运行 ionic cordova运行浏览器--verbose 时,出现错误“当前工作目录不是基于Cordova的项目”。请参见下面的错误输出。

我注意到该命令创建了一个“ www”文件夹,只是在几秒钟后再次将其删除。当我在删除文件夹后手动添加该文件夹时(但是当命令仍在运行时),我可以防止该错误。但是,“ www”文件夹将保持空白,并且所提供的网页将显示找不到文件。

Current working directory is not a Cordova-based project.
CordovaError: Current working directory is not a Cordova-based project.
at Object.cdProjectRoot (C:\nvm\v11.3.0\node_modules\cordova\node_modules\cordova-lib\src\cordova\util.js:170:15)
at C:\nvm\v11.3.0\node_modules\cordova\node_modules\cordova-lib\src\cordova\run.js:29:40
at _fulfilled (C:\nvm\v11.3.0\node_modules\cordova\node_modules\q\q.js:854:54)
at C:\nvm\v11.3.0\node_modules\cordova\node_modules\q\q.js:883:30
at Promise.promise.promiseDispatch (C:\nvm\v11.3.0\node_modules\cordova\node_modules\q\q.js:816:13)
at C:\nvm\v11.3.0\node_modules\cordova\node_modules\q\q.js:877:14
at runSingle (C:\nvm\v11.3.0\node_modules\cordova\node_modules\q\q.js:137:13)
at flush (C:\nvm\v11.3.0\node_modules\cordova\node_modules\q\q.js:125:13)
at internalTickCallback (internal/process/next_tick.js:70:11)
at process._tickCallback (internal/process/next_tick.js:47:5)
[ERROR] An error occurred while running subprocess cordova.

    cordova run browser --verbose exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.
ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
ionic:cli-framework:utils:process onBeforeExit handler: running 2 functions +1ms
ionic:cli-framework:utils:process error while killing process tree for 15736: { Error: Command failed: taskkill /pid 15736 /T /F
ionic:cli-framework:utils:process ERROR: The process "15736" not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:294:12)
ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:182:13)
ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:978:16)
ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
ionic:cli-framework:utils:process   killed: false,
ionic:cli-framework:utils:process   code: 128,
ionic:cli-framework:utils:process   signal: null,
ionic:cli-framework:utils:process   cmd: 'taskkill /pid 15736 /T /F' } +288ms
ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 15736 /T /F
ionic:cli-framework:utils:process ERROR: The process "15736" not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:294:12)
ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:182:13)
ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:978:16)
ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
ionic:cli-framework:utils:process   killed: false,
ionic:cli-framework:utils:process   code: 128,
ionic:cli-framework:utils:process   signal: null,
ionic:cli-framework:utils:process   cmd: 'taskkill /pid 15736 /T /F' } +6ms
ionic:cli-framework:utils:process error while killing process tree for 10672: { Error: Command failed: taskkill /pid 10672 /T /F
ionic:cli-framework:utils:process ERROR: The process "10672" not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:294:12)
ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:182:13)
ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:978:16)
ionic:cli-framework:utils:process     at Socket.stream.socket.on (internal/child_process.js:395:11)
ionic:cli-framework:utils:process     at Socket.emit (events.js:182:13)
ionic:cli-framework:utils:process     at Pipe._handle.close (net.js:616:12)
ionic:cli-framework:utils:process   killed: false,
ionic:cli-framework:utils:process   code: 128,
ionic:cli-framework:utils:process   signal: null,
ionic:cli-framework:utils:process   cmd: 'taskkill /pid 10672 /T /F' } +7ms
ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 10672 /T /F
ionic:cli-framework:utils:process ERROR: The process "10672" not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:294:12)
ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:182:13)
ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:978:16)
ionic:cli-framework:utils:process     at Socket.stream.socket.on (internal/child_process.js:395:11)
ionic:cli-framework:utils:process     at Socket.emit (events.js:182:13)
ionic:cli-framework:utils:process     at Pipe._handle.close (net.js:616:12)
ionic:cli-framework:utils:process   killed: false,
ionic:cli-framework:utils:process   code: 128,
ionic:cli-framework:utils:process   signal: null,
ionic:cli-framework:utils:process   cmd: 'taskkill /pid 10672 /T /F' } +6ms
ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +8ms

详细信息

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (C:\nvm\v11.3.0\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.15 (C:\Users\Simon Driesen\Projects\questionnaire-app\node_modules\@ionic\angular)
   @angular-devkit/build-angular : 0.7.5 (C:\Users\Simon Driesen\Projects\questionnaire-app\node_modules\@angular-devkit\build-angular)
   @angular-devkit/schematics    : 7.1.0
   @angular/cli                  : 7.1.0
   @ionic/angular-toolkit        : 1.2.0 (C:\Users\Simon Driesen\Projects\questionnaire-app\node_modules\@ionic\angular-toolkit)

Cordova:

   cordova (Cordova CLI) : not installed
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   NodeJS : v11.3.0 (C:\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

2 个答案:

答案 0 :(得分:0)

尝试执行const combined = combineLatest(source1, source2, source3, source4); combined.subscribe( chart=> { if (chart[0] != undefined && chart[1] != undefined && chart[2] != undefined && chart[2] != undefined && chart[3] != undefined) { this.chartstest= chart[0]; callFunction(test); }, error => { console.log(error); }, () => { this.loading = false; } ); 。也许项目中缺少一些Cordova节点模块。

答案 1 :(得分:0)

在运行命令之前,您是否尝试过创建www文件夹?

如果可行,请尝试将www文件夹添加到源代码管理系统(git,svn等)中,以便在签出代码时创建该文件夹,从而阻止了构建系统尝试重新创建。

在您的.gitignore文件(如果使用git)中,添加以下行:

 # excludes everything inside the folder
www/*
# but do not exclude .gitkeep file, so the folder can be checked into the repository
!www/.gitkeep