magento / pwa-studio

🛠Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.07k stars 683 forks source link

[bug]: @magento/create-pwa not working in version v1.1.0-beta.1 #2297

Closed fooman closed 4 years ago

fooman commented 4 years ago

Describe the bug Trying to install the latest beta version of create-pwa ends up with error message Cannot getTargetsOf("@magento/pwa-buildpack"): @magento/pwa-buildpack has not yet declared

To reproduce Steps to reproduce the behavior:

  1. npm init @magento/pwa@1.1.0-beta.1

Expected behavior Command succeeds

Actual behavior

@magento/create-pwa v1.1.0-beta.1
Creating a PWA Studio project
? 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 Kristof Ringleff, Fooman <me@example.com>
? Magento instance to use as a backend (will be added to `.env` file) 2.3.3-venia-cloud
? Braintree API token to use to communicate with your Braintree instance (will be added to `.env` file) sandbox_8yrzsvtm_s2bg8fs563crhqzk
? NPM package management client to use yarn
? Install package dependencies with yarn after creating project Yes

Running command:

buildpack create-project my-project --template "venia-concept" --name "my-project" --author "Kristof Ringleff, Fooman <me@example.com>" --backend-url "https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/" --braintree-token "sandbox_8yrzsvtm_s2bg8fs563crhqzk" --npm-client "yarn"

  ℹ  Finding @magento/venia-concept tarball on NPM
  ℹ  Downloading and unpacking https://registry.npmjs.org/@magento/venia-concept/-/venia-concept-5.0.1.tgz
  ℹ  Unpacked @magento/venia-concept
  ℹ  Creating a new PWA project 'my-project' in my-project
  ⓧ  Error: /Users/kristof/Projects/tmp-pwa-create: Cannot getTargetsOf("@magento/pwa-buildpack"): @magento/pwa-buildpack has not yet declared
(node:37970) UnhandledPromiseRejectionWarning: Error: Command failed: /bin/sh -c /Users/kristof/.npm/_npx/36822/lib/node_modules/@magento/create-pwa/node_modules/@magento/pwa-buildpack/bin/buildpack create-project my-project --template "venia-concept" --name "my-project" --author "Kristof Ringleff, Fooman <me@example.com>" --backend-url "https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/" --braintree-token "sandbox_8yrzsvtm_s2bg8fs563crhqzk" --npm-client "yarn"
    at makeError (/Users/kristof/.npm/_npx/36822/lib/node_modules/@magento/create-pwa/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/Users/kristof/.npm/_npx/36822/lib/node_modules/@magento/create-pwa/node_modules/execa/index.js:278:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:37970) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:37970) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Please complete the following device information:

Please let us know what packages this bug is in regards to:

tjwiebell commented 4 years ago

@fooman - I'll have to double check documentation for create-pwa and the underlying buildpack create-project utility it uses, but I would not expect this to work. I thought you would maybe still get a successful install, but it would be the latest stable 5.0.1, so I'll run this down some more just in case this is a release bug. Some explanation first.

There was a vision for a much more robust template system that would allow you to use any package string as a template, eg. @magento/venia-concept@6.0.0-beta.1, and I think even just a local directory with a valid package.json that it would pack and simulate an install from npm. Present state is limited to a single template that uses @magento/venia-concept@latest or with the flag DEBUG_PROJECT_CREATION it will assume you're in the monorepo and simulate pack and install from npm of packages/venia-concept.

I pulled down release/6.0 and was able to get a successful installation with DEBUG_PROJECT_CREATION=1 packages/create-pwa/bin/create-pwa, which I think should accurately simulate npm init @magento/pwa once 6.0.0 is published and has the latest tag. Could you try that out locally to see if you get the same error?

Always good to loop in @zetlen on buildpack related issues, so I'll run this by him during standup to get his opinion as well. Thanks for the bug report, we'll follow up if we have any questions.

fooman commented 4 years ago

Can confirm that the clone approach seems to work:

git clone git@github.com:magento/pwa-studio.git tmp-pwa-create
cd tmp-pwa-create
git checkout release/6.0
yarn install
DEBUG_PROJECT_CREATION=1 packages/create-pwa/bin/create-pwa

And the resulting ./my-project/package.json gives me a starting point for finding out the mix of dependencies and version numbers to merge into my existing project to update to the latest beta.

fooman commented 4 years ago

Might not apply cleanly as there is a few other packages in there but here's my diff on package.json:

--- package.json    (revision 337db767b1d41bc997e4dcfc4b7c339a19034fde)
+++ package.json    (date 1585703614497)
@@ -9,7 +9,7 @@
     "buildpack": "buildpack",
     "build": "yarn run build:prod",
     "build:analyze": "yarn run clean && mkdir dist && webpack -p --profile --no-progress --env.mode production --json > dist/build-stats.json && webpack-bundle-analyzer dist/build-stats.json",
-    "build:dev": "yarn run clean && yarn run validate-queries && webpack --progress --env.mode development",
+    "build:dev": "yarn run clean && yarn run validate-queries && webpack --no-progress --env.mode development",
     "build:prod": "yarn run clean && webpack --no-progress --env.mode production",
     "clean": "rimraf dist",
     "download-schema": "graphql get-schema --project my-project --insecure",
@@ -36,6 +36,7 @@
     "react-with-breakpoints": "^4.0.4"
   },
   "devDependencies": {
+    "@adobe/apollo-link-mutation-queue": "~1.0.0",
     "@babel/core": "~7.3.4",
     "@babel/plugin-proposal-class-properties": "~7.3.4",
     "@babel/plugin-proposal-object-rest-spread": "~7.3.4",
@@ -45,12 +46,13 @@
     "@babel/plugin-transform-runtime": "~7.4.4",
     "@babel/preset-env": "~7.3.4",
     "@babel/runtime": "~7.4.2",
-    "@magento/babel-preset-peregrine": "~1.0.1",
+    "@magento/babel-preset-peregrine": "1.0.1",
     "@magento/eslint-config": "~1.5.0",
-    "@magento/peregrine": "~5.0.1",
-    "@magento/pwa-buildpack": "~5.0.0",
-    "@magento/upward-js": "~4.0.0",
-    "@magento/venia-ui": "~2.0.1",
+    "@magento/pagebuilder": "1.0.0-beta.1",
+    "@magento/peregrine": "6.0.0-beta.1",
+    "@magento/pwa-buildpack": "5.1.0-beta.1",
+    "@magento/upward-js": "4.0.1-beta.1",
+    "@magento/venia-ui": "3.0.0-beta.1",
     "@storybook/react": "~5.2.6",
     "apollo-cache-inmemory": "~1.6.3",
     "apollo-cache-persist": "~0.1.1",
@@ -82,10 +84,13 @@
     "file-loader": "~4.0.0",
     "graphql": "14.3.1",
     "graphql-cli": "~3.0.11",
-    "graphql-cli-validate-magento-pwa-queries": "~1.2.0",
+    "graphql-cli-validate-magento-pwa-queries": "1.3.0-beta.1",
     "graphql-tag": "~2.10.1",
     "html-webpack-plugin": "~3.2.0",
-    "informed": "~2.1.13",
+    "informed": "~2.11.17",
+    "jarallax": "~1.11.1",
+    "load-google-maps-api": "~2.0.1",
+    "lodash.escape": "~4.0.1",
     "lodash.over": "~4.7.0",
     "memoize-one": "~5.0.0",
     "memory-fs": "~0.4.1",
@@ -94,10 +99,10 @@
     "prop-types": "~15.7.2",
     "react": "~16.9.0",
     "react-dom": "~16.9.0",
-    "react-feather": "~2.0.3",
     "react-hot-loader": "~4.12.17",
     "react-redux": "~7.1.1",
     "react-router-dom": "~5.1.0",
+    "react-slick": "~0.25.2",
     "react-tabs": "~3.0.0",
     "react-test-renderer": "~16.9.0",
     "redux": "~4.0.1",
@@ -117,7 +122,7 @@
   "optionalDependencies": {
     "iltorb": "~2.0.0",
     "node-zopfli-es": "~1.0.3",
-    "sharp": "~0.22.1"
+    "sharp": "~0.23.3"
   },
   "engines": {
     "node": "10.x",
fooman commented 4 years ago

Follow on issue posted here https://github.com/magento/pwa-studio/issues/2301

tjwiebell commented 4 years ago

Closing in favor of #2301

ArunKathir98 commented 4 years ago

How to setup pwa on windows system anyone help me please.