I have created cordova mobilefirst 8 application using CLI with mfp template. Followed below commands

MFP version: 8.0.0.00-20171024-121931

cordova create Hello com.example.helloworld HelloWorld --template cordova-template-mfp

cd Hello

cordova platform add browser

While adding browser platform getting below copy errors:

cp: dest file no such file or directory: D:\Projects\Mobilefirst\HelloCordova\Hello\platforms\browse
r\platform_www\plugins\cordova-plugin-mfp\worklight\analytics

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\ibmmfpf.js

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\typings

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\node_modules\express

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\node_modules\request

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\node_modules\jssha

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\node_modules\promiz

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\node_modules\sjcl

cp: copyFileSync: could not write to dest file (code=ENOENT):D:\Projects\Mobilefirst\HelloCordova\He
llo\platforms\browser\platform_www\plugins\cordova-plugin-mfp\worklight\proxy.js

Its displaying platform added successfully to the app. I register app to MFP as well.

While running it to browser we are getting error.

cordova run browser

D:\Projects\Mobilefirst\HelloCordova\Hello>cordova run browser
module.js:471
    throw err;
    ^

Error: Cannot find module 'D:\Projects\Mobilefirst\HelloCordova\Hello\platforms\browser\www\plugins\
cordova-plugin-mfp\worklight\proxy.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:504:3
startPage = index.html
Static file server running @ http://localhost:8000/index.html
CTRL + C to shut down
Error: exit code 1

Please suggest how can we fix this issue. Is anything we need to do addition to this?

2

There are 2 best solutions below

2
On

I tried with the steps you have given and I am able to see my application successfully running at http://localhost:9081/HelloWorld/

only difference is that I see this while adding browser

sudo cordova platform add browser
Adding browser project...
Running command: /Users/manjuk/.cordova/lib/npm_cache/cordova-
browser/4.1.0/package/bin/create /Users/manjuk/Hello/platforms/browser 
com.example.helloworld HelloWorld
Creating Browser project. Path: platforms/browser
Discovered plugin "cordova-plugin-mfp" in config.xml. Adding it to the 
project
Fetching plugin "cordova-plugin-mfp@~8.0" via npm
Installing "cordova-plugin-mfp" for browser
Fetching plugin "cordova-plugin-device" via npm
Installing "cordova-plugin-device" for browser
Fetching plugin "cordova-plugin-dialogs" via npm
Installing "cordova-plugin-dialogs" for browser
Fetching plugin "cordova-plugin-globalization" via npm
Installing "cordova-plugin-globalization" for browser
***The run script is being replaced to suppress cordova's default 
 browser.***
If you made changes to your run script(in cordova folder), manually 
merge 
run.bak with the run script that is provided with IBM MobileFirst 
Platform Foundation
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding 
it 
to the project
Fetching plugin "cordova-plugin-splashscreen@~3" via npm
Installing "cordova-plugin-splashscreen" for browser
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it 
to 
the project
Fetching plugin "cordova-plugin-whitelist@~1" via npm
Installing "cordova-plugin-whitelist" for browser
0
On

You can use npm version: 3.10.10

In your case it is clearly showing that you are under proxy.