Coder Social home page Coder Social logo

Comments (14)

regnete avatar regnete commented on May 30, 2024 3

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();
    });

};

from cordova-windows.

feiandytan avatar feiandytan commented on May 30, 2024 3

@pjc2007 , [email protected] is working. You can downgrade the cordova-windows by running the commands:

cordova platform rm windows
cordova platform add [email protected]

from cordova-windows.

brodybits avatar brodybits commented on May 30, 2024 1

@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?

from cordova-windows.

janpio avatar janpio commented on May 30, 2024 1

Feel free to take over and figure things out. I can and will not spend time on this right now or the near future.

from cordova-windows.

brodybits avatar brodybits commented on May 30, 2024 1

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.

from cordova-windows.

janpio avatar janpio commented on May 30, 2024

This has already been fixed with #331, but not released yet: 7.0.0...master

from cordova-windows.

Jahrenski avatar Jahrenski commented on May 30, 2024

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.
try { fs.mkdirSync(destinationDirectory, { recursive: true }); } catch (err) { if (err.code !== 'EEXIST') throw err; }

from cordova-windows.

pjc2007 avatar pjc2007 commented on May 30, 2024

I tried adding the above hook in config.xml, and the win_winjs_fix.js from @Jahrenski, I removed and readded windows to my Ionic/Cordova project, but I still get the error when adding Windows. I don't have the node_modules\cordova-windows\node_modules\winjs folder.

from cordova-windows.

darylldawn avatar darylldawn commented on May 30, 2024

@pjc2007 any updates with this? Currently facing the same problem while waiting for the official release.

from cordova-windows.

pjc2007 avatar pjc2007 commented on May 30, 2024

@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.

from cordova-windows.

pjc2007 avatar pjc2007 commented on May 30, 2024

@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

fatal error C1083: Cannot open include file: 'winapifamily.h': No such file or directory [D:\dev\myapp\plugins\cordova-sqlite-storage\src\windows\SQLite3-WinRT-sync\SQLite3\SQLite3.UWP.vcxproj]

but I now know that is not related to this issue

from cordova-windows.

darylldawn avatar darylldawn commented on May 30, 2024

@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
(Platform Toolset, Windows 10 SDK, etc) via Visual Studio Installer, setting an environment variable (sqlite related) and finally hooking the temporary fix above, I was able to run.

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!

from cordova-windows.

pjc2007 avatar pjc2007 commented on May 30, 2024

@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.

from cordova-windows.

brodybits avatar brodybits commented on May 30, 2024

Thanks @janpio, I will take it over when I get a chance.

from cordova-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.