Giter Site home page Giter Site logo

Comments (6)

sindresorhus avatar sindresorhus commented on May 29, 2024

Looks it doesn't find the router. Keep in mind that base is resolved relatively to the Gruntfile, not the current directory. Run this from the directory of your Gruntfile and make sure the ouput is the path to your router: $ node -e 'console.log(require("path").resolve("../../../.."))'.

from grunt-php.

connelhooley avatar connelhooley commented on May 29, 2024

I've cd'ed to the GruntFile and ran the command you specified, but it threw an error. I was running it in PowerShell so I tried cmd. On cmd it does not output anything.

PS C:\Users\connelhooley> cd .\Documents\Web\connelhooley\wp-content\themes\connelhooley\dev\
PS C:\Users\connelhooley\Documents\Web\connelhooley\wp-content\themes\connelhooley\dev> ls


    Directory: C:\Users\connelhooley\Documents\Web\connelhooley\wp-content\themes\connelhooley\dev


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       07/08/2015     22:11                .sass-cache
d-----       09/08/2015     16:09                dist
d-----       07/08/2015     22:25                node_modules
d-----       09/08/2015     16:09                temp
-a----       08/08/2015     00:57             39 .bowerrc
-a----       07/08/2015     20:22             92 .ftppass
-a----       08/08/2015     00:57             47 .gitignore
-a----       09/08/2015     20:07            696 bower.json
-a----       09/08/2015     20:06           7543 Gruntfile.js
-a----       08/08/2015     00:57            973 package.json
-a----       10/08/2015     10:48             10 router.php


PS C:\Users\connelhooley\Documents\Web\connelhooley\wp-content\themes\connelhooley\dev> node -e 'console.log(require("path").resolve("../../../.."))'

[eval]:1
console.log(require(path).resolve(../../../..))
                                  ^
SyntaxError: Unexpected token .
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:536:25)
    at startup (node.js:80:7)
    at node.js:906:3

It's worth noting that the router file is kept in the same folder as the GruntFile. Does this task expect the router to be in the base path? The php command looks in the current directory for the router (I ran it from the same directory as the GruntFile) and can find it.

Thanks

from grunt-php.

connelhooley avatar connelhooley commented on May 29, 2024

Just got the command to work by escaping the double quotes. Works as expected and returns the path to the WordPress folder I want to serve:

PS C:\Users\connelhooley\Documents\Web\connelhooley\wp-content\themes\connelhooley\dev> node -e 'console.log(require(\"path\").resolve(\"../../../..\"))'
C:\Users\connelhooley\Documents\Web\connelhooley

from grunt-php.

sindresorhus avatar sindresorhus commented on May 29, 2024

I have two potential fixes. Can you try them both and let me know if any of them works?

  1. 0123cba
  2. b934191

from grunt-php.

connelhooley avatar connelhooley commented on May 29, 2024

I can confirm b934191 fixes the issue for me. Sorry about the late reply.

Thanks!

from grunt-php.

thegregthomp avatar thegregthomp commented on May 29, 2024

I had the same issue and reverted to 1.5.0 and it worked fine. There's something weird with the base & router setting combination with the 1.5.1 fix. My 1.5.0 settings...

     php: {
            dev: {
                options: {
                    hostname: 'localhost',
                    port: 8889,
                    base: 'cms/public', // Project root
                    keepalive: false,
                    open: false,
                    router:'router.php',
                    env: {
                        DATABASE_HOST: 'localhost',
                        DATABASE_USER: '*',
                        DATABASE_PASS: '*',
                        DATABASE_NAME: '*',
                    }
                }
            }
        },

from grunt-php.

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.