Simon Driesen
Simon Driesen

Reputation: 3

Current working directory is not a Cordova-based project

when running ionic cordova run browser --verbose in the root of my Ionic4 project I get the error "Current working directory is not a Cordova-based project.". See the error output bellow.

I noticed the command creates a "www" folder only to remove it again a few seconds later. When I manually add the folder after it was removed (but while the command is still running) I can prevent the error. However the "www" folder will stay empty and the served webpage will say no file found.

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

Details

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

Upvotes: 0

Views: 3327

Answers (2)

flags
flags

Reputation: 511

Have you tried to create the www folder before running the command?

If that works, then try to add the www folder to your source control system (git, svn, etc...) so when you checkout the code you get that folder created, thus preventing the build system to try to recreate.

In your .gitignore file (if using git), add these lines:

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

Upvotes: 2

heatstreak
heatstreak

Reputation: 119

Try doing a npm install. Maybe some Cordova node modules are missing from your project.

Upvotes: 0

Related Questions