Question

I'm starting a new PWA project, so I'm 'extending' from venia theme this way:

yarn buildpack create-project 'testproject' --template venia-concept --backendUrl https://localtest.com --npmClient yarn --install true

According to Magento docs, that command will generate a new pwa project based on venia theme. Now, when I'm trying to run

yarn build run

I'm getting this error:

TypeError: Cannot destructure property `getMediaURL` of 'undefined' or 'null'.

This is the stack:

TypeError: Cannot destructure property `getMediaURL` of 'undefined' or 'null'.
    at Object.<anonymous> (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/webpack.config.js:4:5)
    at Module._compile (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at WEBPACK_OPTIONS (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:115:13)
    at requireConfig (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:117:6)
    at /Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:124:17
    at Array.forEach (<anonymous>)
    at module.exports (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:122:15)
    at yargs.parse (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/cli.js:228:39)
    at Object.parse (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/yargs/yargs.js:567:18)
    at /Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/cli.js:206:8
    at Object.<anonymous> (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/cli.js:500:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack/bin/webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I havent found an answer for that error yet. Anyone around who has been through the same?

Was it helpful?

Solution

Just got it working by doing this:

In my project root directory:

git clone https://github.com/magento/pwa-studio

then:

cd pwa-studio 
yarn install

And create the new project:

yarn create @magento/pwa        
? Project root directory (will be created if it does not exist) ../my_project
? Short name of the project to put in the package.json "name" field my_project
? Name of the author to put in the package.json "author" field author
? Magento instance to use as a backend (will be added to `.env` file) Other
? URL of a Magento instance to use as a backend (will be added to `.env` file) https://local.myproject.com
? NPM package management client to use yarn
? Install package dependencies with yarn after creating project Yes

Then just go to my_project directory and

yarn watch 
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top