liferay / liferay-frontend-projects

A monorepo containing assorted Frontend Infrastructure Team projects
Other
69 stars 68 forks source link

Error apolloClient #935

Closed jcbarcelos closed 2 years ago

jcbarcelos commented 2 years ago

Hi, how are you? I am installing apollo a link https://www.apollographql.com/docs/react/get-started and use code https://www.apollographql.com/docs/react/get-started, i am with this error down logger.jss:31 liferay-amd-loader | Errors returned from server for require( ['ReactApp@1.0.0'] ): ["Missing dependency '@ReactApp$apollo/client@3.6.4/main.cjs' of 'ReactApp@1.0.0/index'"]

react_devtools_backend.js:4026 liferay-amd-loader | A require() call has failed but no failure handler was provided. Note that even if the call stack of this error trace looks like coming from the Liferay AMD Loader, it is not an error in the Loader what has caused it, but an error caused by the require() call. The reason why the Loader is in the stack trace is because it is printing the error so that it doesn't get lost. However, we recommend providing a failure handler in all require() calls to be able to recover from errors better and to avoid the appearance of this message.

Some information about the require() call follows: · Require call id: 2 · Required modules: ['ReactApp@1.0.0'] · Missing modules: (n/a) · Stack trace of the require() call: Error at e.value (http://localhost:8080/o/frontend-js-loader-modules-extender/loader.js?t=1652455629672:1:16972) at http://localhost:8080/home?segmentsExperienceId=40625:2614:17 Error: Unsatisfied dependency: @ReactApp$apollo/client found in module ReactApp@1.0.0/index at loader.jss:698:15 at Array.map () at loader.jss:680:59 at Array.forEach () at e.value (loader.jss:642:34) at loader.jss:423:10 overrideMethod @ react_devtools_backend.js:4026 value @ logger.jss:31 n @ loader.jss:243 (anonymous) @ loader.jss:472 (anonymous) @ loader.jss:450 Promise.catch (async) value @ loader.jss:292 (anonymous) @ home?segmentsExperienceId=40625:2614 loader.jss:698 Uncaught (in promise) Error: Unsatisfied dependency: @ReactApp$apollo/client found in module ReactApp@1.0.0/index at loader.jss:698:15 at Array.map () at loader.jss:680:59 at Array.forEach () at e.value (loader.jss:642:34) at loader.jss:423:10

bryceosterhaus commented 2 years ago

Could you provide some exact steps on how you created your module? Did you use @liferay/cli or some other method to bootstrap your project?

jcbarcelos commented 2 years ago

no bootstrap the project, when i use @liferay/cli this error npm run deploy

[teste]@1.0.0 deploy liferay deploy

Deploying project to Liferay local installation ❓ Please enter your local Liferay installation directory /home/jc/Downloads/liferay-ce-portal-tomcat-7.2.1-ga2-20191111141448326/liferay-ce-portal-7.2.1-ga2 node:fs:585 handleErrorFromBinding(ctx); ^

Error: ENOENT: no such file or directory, open '/home/jc/LiferayWorkspacewithDevStudio/liferay7.2/modules/[teste]/.liferay.json' at Object.openSync (node:fs:585:3) at Object.readFileSync (node:fs:453:35) at Deploy.storeDir (/home/jc/LiferayWorkspacewithDevStudio/liferay7.2/modules/[teste]/node_modules/@liferay/js-toolkit-core/lib/project/liferayCli/Deploy.js:28:53) at promptForDeployPath (/home/jc/LiferayWorkspacewithDevStudio/liferay7.2/modules/[teste]/node_modules/@liferay/portal-base/lib/deploy.js:55:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Object.deploy (/home/jc/LiferayWorkspacewithDevStudio/liferay7.2/modules/[teste]/node_modules/@liferay/portal-base/lib/deploy.js:21:15) at async run (/home/jc/LiferayWorkspacewithDevStudio/liferay7.2/modules/[teste]/node_modules/@liferay/portal-base/lib/index.js:48:4) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/home/jc/LiferayWorkspacewithDevStudio/liferay7.2/modules/[teste]/.liferay.json' }

bryceosterhaus commented 2 years ago

We will need some smaller, more granular steps, for reproducing the issue. If you could provide some specific steps, we can investigate. Steps would look something like

  1. download dxp bundle 7.2.1-ga2
  2. run liferay new my-project
  3. run yarn install
  4. add apollo yarn add ...

^ please try to include as detailed steps as possible

jcbarcelos commented 2 years ago

hi, sorry for the deplay
this is the process blade init -v 7.2 [teste] inside the module, comands `liferay new my-project

👋 Welcome to Liferay Project Generator v1.1.0

⚙ Gathering information to create project... ℹ️ Using project name: my-project ? What type of project do you want to create? (Use arrow keys) ❯ Liferay Platform Project Liferay Remote App Project `

⚙ Gathering information to create project... ℹ️ Using project name: my-project ? What type of project do you want to create? Liferay Platform Project ? What is the human readable description of your project? My Project ? Which will be your target platform? Liferay Portal CE 7.3 Liferay DXP 7.3 Liferay Portal CE 7.2 ❯ Liferay DXP 7.2 Liferay Portal CE 7.1 Liferay DXP 7.1 Liferay Portal CE (not sharing platform's packages) (Move up and down to reveal more choices)

⚙ Gathering information to create project... ℹ️ Using project name: my-project ? What type of project do you want to create? Liferay Platform Project ? What is the human readable description of your project? My Project ? Which will be your target platform? Liferay DXP 7.2 ? Which will be your project type? (Use arrow keys) Angular Plain JavaScript ❯ React Shared bundle Vue.js finaly

`liferay new my-project

👋 Welcome to Liferay Project Generator v1.1.0

⚙ Gathering information to create project... ℹ️ Using project name: my-project ? What type of project do you want to create? Liferay Platform Project ? What is the human readable description of your project? My Project ? Which will be your target platform? Liferay DXP 7.2 ? Which will be your project type? React ? Under which category should your widget be listed? category.sample

⚙ Generating project... ℹ️ Creating project structure ℹ️ Configuring target platform... ℹ️ Adding @liferay/dxp-7.2 as a dependency ℹ️ Adding localization support to project... ℹ️ Creating Language.properties file ℹ️ Adding configuration support to project... ℹ️ Creating configuration.json file ℹ️ Adding configuration name for English language ℹ️ Generating porlet... ℹ️ Creating styles.scss file ℹ️ Setting porlet headers ℹ️ Set portlet resource bundle ℹ️ Add portlet display name for English language ℹ️ Configuring build... ℹ️ Adding build artifacts to .gitignore ℹ️ Configuring npm build scripts ℹ️ Configuring deployment... ℹ️ Adding dist directory to .gitignore ℹ️ Configuring npm build scripts ℹ️ Generating sample code... ℹ️ Configuring Babel ℹ️ Creating React widget ℹ️ Adding labels for English language ℹ️ Adding sample CSS styles ℹ️ Adding configuration schemas ℹ️ Adding configuration labels for English language

✔️ Project has been generated successfully!

You can now run the following commands to build your project:

$ cd my-project ↩
$ npm install ↩ 
$ npm run build ↩ 

This will create a my-project.jar file in your my-project/dist folder that you can deploy to your local Liferay server. cd my-project yarn install yarn build result $ liferay build Building project for target platform: @liferay/dxp-7.2 ℹ️ Copying 0 assets... ℹ️ Running sass on 1 asset files... ℹ️ Running babel on 2 files... ℹ️ Running liferay-npm-bundler... Bundling took 300ms ✔️ Project successfully built Done in 2.69s. error execute yarn deploy $ liferay deploy Deploying project to Liferay local installation ❓ Please enter your local Liferay installation directory /home/user/Downloads/liferay-ce-portal-tomcat-7.2.1-ga2-20191111141448326/liferay-ce-portal-7.2.1-ga2 node:fs:585 handleErrorFromBinding(ctx); ^

Error: ENOENT: no such file or directory, open '/home/user/LiferayWorkspacewithDevStudio/liferay7.2/modules/my-project/.liferay.json' at Object.openSync (node:fs:585:3) at Object.readFileSync (node:fs:453:35) at Deploy.storeDir (/home/user/LiferayWorkspacewithDevStudio/liferay7.2/modules/my-project/node_modules/@liferay/js-toolkit-core/lib/project/liferayCli/Deploy.js:28:53) at promptForDeployPath (/home/user/LiferayWorkspacewithDevStudio/liferay7.2/modules/my-project/node_modules/@liferay/portal-base/lib/deploy.js:55:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Object.deploy (/home/user/LiferayWorkspacewithDevStudio/liferay7.2/modules/my-project/node_modules/@liferay/portal-base/lib/deploy.js:21:15) at async run (/home/user/LiferayWorkspacewithDevStudio/liferay7.2/modules/my-project/node_modules/@liferay/portal-base/lib/index.js:48:4) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/home/user/LiferayWorkspacewithDevStudio/liferay7.2/modules/my-project/.liferay.json' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

izaera commented 2 years ago

Hi @jcbarcelos :wave:

If you are using blade you need to report the error upstream (that is: blade) before here, because we need:

  1. To discard the issue is due to blade
  2. Exact steps on how to reproduce the problem

Another option would be that you generate a pure JS Toolkit project that mimicks what you are doing with blade and, if it can be reproduced like that, send us the steps to make it fail or a link to a github repo with the failing code.

Thx.

izaera commented 2 years ago

Closed due to timeout. Feel free to reopen if needed.