-
Notifications
You must be signed in to change notification settings - Fork 170
WinJS is not copied when adding windows platform #341
Comments
This has already been fixed with #331, but not released yet: 7.0.0...master |
Temporarily fix via cordova hook when using unfixed version 7.0.0: config.xml: <platform name="windows">
<hook type="before_prepare" src="hooks/win_winjs_fix.js" />
</platform> hooks/win_winjs_fix.js: const path = require('path');
const shell = require('shelljs');
const fs = require('fs');
module.exports = function (ctx)
{
if (!ctx.opts.platforms.includes('windows'))
return;
return new Promise(function (resolve, reject)
{
const root = ctx.opts.projectRoot;
const projectPath = path.join(root, 'platforms', 'windows');
const destinationDirectory = path.join(projectPath, 'platform_www', 'WinJS', 'js');
const destBaseJsPath = path.join(destinationDirectory, 'base.js');
//var srcBaseJsPath = path.join(root, 'node_modules', 'winjs', 'js', 'base.js');
const srcBaseJsPath = require.resolve('winjs/js/base');
fs.mkdirSync(destinationDirectory, { recursive: true });
shell.cp('-f', srcBaseJsPath, destBaseJsPath);
resolve();
});
}; |
I suggest you put the mkdir in a try catch otherwise it will be blocking the compile most of the time. |
I tried adding the above hook in config.xml, and the |
@pjc2007 any updates with this? Currently facing the same problem while waiting for the official release. |
@darylldawn - no unfortunately. At the moment I cannot build the Windows version of my app at all. e.g. I get this error.. Not sure if it related to this one. Soon, the need to going to become more urgent for me. |
@pjc2007 , [email protected] is working. You can downgrade the cordova-windows by running the commands:
|
@feiandytan - thankyou! I tried what you suggested and I not longer get the error. I do still get my build errors with my Ionic Windows SQLite project ie
but I now know that is not related to this issue |
@pjc2007 Hey, I was able to build just a while ago with @regnete's solution. I didn't have the same exact error as you, but I was initially having problems with SQLite3. After installing all the dependencies Since it might be related to one of the plugins you are currently using (I have a hunch it might be the sqlite plugin -- I also did the remove and add one by one plugin procedure), you can also check out issues at their respective repositories (but of course I think you might already have). Looking forward to the 7.1.0 release! |
@darylldawn - ok thanks, Yes I will need to do all that. I think my Visual Studio and related tools may be messed up after a few uninstalls and updates of them. Perhaps Visual Studio 2019 install mucked it up. |
@janpio I think we still need to make this release. I recall it was discussed on the mailing list but was stalled for some reason (we were waiting for a response on something). Any way we can unblock the release? |
Feel free to take over and figure things out. I can and will not spend time on this right now or the near future. |
Thanks @janpio, I will take it over when I get a chance. |
This should be fixed in [email protected] patch release. Please report if this issue continues to persist in 7.0.1 or any later releases. |
Bug Report
Problem
WinJS is not copied when adding windows platform to cordova application.
What is expected to happen?
The winjs\js\base.js should be copied correctly.
What does actually happen?
The winjs\js\base.js is not copied, and the console prints the error log:
cp: no such file or directory: C:\Users\i062893\cordova-workspace\attachmenttest\node_modules\cordova-windows\node_modules\winjs\js\base.js
Information
Command or Code
I use following commands:
C:\Users\i062893\cordova-workspace>cordova --version
9.0.0 ([email protected])
C:\Users\i062893\cordova-workspace>cordova create attachmenttest
Creating a new cordova project.
C:\Users\i062893\cordova-workspace>cd attachmenttest
C:\Users\i062893\cordova-workspace\attachmenttest>cordova platforms add windows
Using cordova-fetch for cordova-windows@^7.0.0
Adding windows project...
Creating Cordova Windows Project:
Path: platforms\windows
Namespace: io.cordova.hellocordova
Name: HelloCordova
cp: no such file or directory: C:\Users\i062893\cordova-workspace\attachmenttest\node_modules\cordova-windows\node_modules\winjs\js\base.js
cp: no such file or directory: C:\Users\i062893\cordova-workspace\attachmenttest\node_modules\cordova-windows\node_modules\winjs\js\base.js
Windows project created with [email protected]
Plugin 'cordova-plugin-whitelist' found in config.xml... Migrating it to package.json
Discovered saved plugin "cordova-plugin-whitelist". Adding it to the project
Installing "cordova-plugin-whitelist" for windows
Adding cordova-plugin-whitelist to package.json
Environment, Platform, Device
Version information
Cordova: 9.0.0
cordova-windows: 7.0.0
Checklist
The text was updated successfully, but these errors were encountered: