Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] AdminLTE fails to install with yarn and custom folder #2561

Closed
FelipeEmerim opened this issue Feb 20, 2020 · 13 comments
Closed

[BUG] AdminLTE fails to install with yarn and custom folder #2561

FelipeEmerim opened this issue Feb 20, 2020 · 13 comments

Comments

@FelipeEmerim
Copy link

To Reproduce

  1. create a .yarnrc file with a custom --modules-folder
  2. run yarn-add admin-lte

Expected behavior
The package should install

Screenshots

internal/modules/cjs/loader.js:800
    throw err;
    ^

Error: Cannot find module 'fs-extra'
Require stack:
- /home/felipe/projects/colplan/public/assets/admin-lte/build/npm/Publish.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/felipe/projects/colplan/public/assets/admin-lte/build/npm/Publish.js:2:17)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/felipe/projects/colplan/public/assets/admin-lte/build/npm/Publish.js'
  ]
}

Environment (please complete the following information):

  • AdminLTE Version: v3.0.2
  • Operating System: Ubuntu 19.10

Additional context
Add any other context about the problem here.

@REJack
Copy link
Collaborator

REJack commented Feb 20, 2020

Thanks for reporting this issue, I'll check this within the next days.

@REJack
Copy link
Collaborator

REJack commented Feb 21, 2020

I may found the problem,
I first tried to add yarn add admin-lte with this .yarnrc content

--modules-folder 'vends'

everything works like it should after some tests, I created a blank folder and added this to .yarnrc by hand

--modules-folder vends

and without the single-quotes yarn add failed.

Please check this 😄

@FelipeEmerim
Copy link
Author

Thanks for the quick response!

I did what you said and it worked perfectly. But, I believe the quotes should not be required. Every other package I have works without them. Plus, many examples of the modules-folder option do not use quotes.

On the other hand the only official docs we have is this and it is not clear about the behavior at all.

Also as a test I tried passing --modules-folder via cli and it behaves exactly the same as putting it in .yarnrc.

Thanks again for the support!!

@REJack
Copy link
Collaborator

REJack commented Feb 21, 2020

But, I believe the quotes should not be required

If I remember right, the quote set it to a string and without it's a constant that some scripts use as string, I didn't figured out how I can require it correctly for this behavior. And I personally set always paths as string with quotes, only if I'm lazy not 😃

Also this look like yarn itself cause this problem and not load the node modules correctly.

Thanks again for the support!!

No problem 😄 I close this issue.

@REJack REJack closed this as completed Feb 21, 2020
@FelipeEmerim
Copy link
Author

FelipeEmerim commented Feb 21, 2020

Sorry for coming back. But when I said it worked I was not quite right. When I put the quotes in my .yarnrc, yarn install the packages to the node_modules folder. That's why it installed the package.

With double quotes I have the same error as not using quotes.

@REJack
Copy link
Collaborator

REJack commented Feb 21, 2020

That's strange :/ I've found this issue yarnpkg/yarn#5200 on yarn's repo that's may related to this.

@FelipeEmerim
Copy link
Author

Thanks again. I will try that.

@juniwalk
Copy link

Hello, have you solved this issue? I am still getting errors.

root@s3:/router/dp_dev/sandbox # yarn -v
1.22.4
root@s3:/router/dp_dev/sandbox # npm -v
6.14.4
root@s3:/router/dp_dev/sandbox # node -v
v13.14.0
root@s3:/router/dp_dev/sandbox # yarn upgrade
yarn upgrade v1.22.4
[1/4] Resolving packages...
warning admin-lte > [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
warning admin-lte > bootstrap-colorpicker > [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
warning admin-lte > tempusdominus-bootstrap-4 > [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
warning admin-lte > pdfmake > pdfkit > fontkit > babel-runtime > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "admin-lte > [email protected]" has incorrect peer dependency "bootstrap@^3.1.1".
warning "admin-lte > [email protected]" has unmet peer dependency "moment-timezone@^0.5.11".
warning "admin-lte > [email protected]" has unmet peer dependency "[email protected]".
[4/4] Rebuilding all packages...
[2/2] ⠄ admin-lte
error /srv/htdocs/dp/dev/sandbox/www/vendor/admin-lte: Command failed.
Exit code: 1
Command: npm run plugins
Arguments: 
Directory: /srv/htdocs/dp/dev/sandbox/www/vendor/admin-lte
Output:
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1592377283211-0.7496240200515996/node but npm is using /usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] plugins /srv/htdocs/dp/dev/sandbox/www/vendor/admin-lte
> node build/npm/Publish.js -v

internal/modules/cjs/loader.js:965
  throw err;
  ^

Error: Cannot find module 'fs-extra'
Require stack:
- /srv/htdocs/dp/dev/sandbox/www/vendor/admin-lte/build/npm/Publish.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)
    at Function.Module._load (internal/modules/cjs/loader.js:838:27)
    at Module.require (internal/modules/cjs/loader.js:1022:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/srv/htdocs/dp/dev/sandbox/www/vendor/admin-lte/build/npm/Publish.js:2:17)
    at Module._compile (internal/modules/cjs/loader.js:1118:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Function.Module._load (internal/modules/cjs/loader.js:875:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/srv/htdocs/dp/dev/sandbox/www/vendor/admin-lte/build/npm/Publish.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] plugins: `node build/npm/Publish.js -v`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] plugins script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-17T07_01_23_836Z-debug.log

@REJack
Copy link
Collaborator

REJack commented Jun 17, 2020

@juniwalk Try to remove your node_modules folder and reinstall with yarn again.

@juniwalk
Copy link

I have custom folder in www/vendor so my assets are in domain root, without the custom folder it works. I tried everything that was mentioned above to be tried and nothing worked. So I did remove the folder to no avail.

@FelipeEmerim
Copy link
Author

FelipeEmerim commented Jun 17, 2020

I solved it by adding these two settings in my .yarnrc file pointing to my custom directory. Note that the paths have to be absolute.

# ./.yarnrc
--*.modules-folder /app/public/assets
env:
  NODE_PATH "/app/public/assets"

@juniwalk
Copy link

@FelipeEmerim Well I don't like hard coding absolute path there but it really does work! Thank you.

@FelipeEmerim
Copy link
Author

@juniwalk Me neither, but it is the only way I got it working. It seems to be a problem with yarn as mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants