Generator-jhipster: "jhipster aws" error "<project>/node_modules/generator-jhipster/node_modules/less" not found

Created on 3 Sep 2017  ·  27Comments  ·  Source: jhipster/generator-jhipster

Overview of the issue

Error running "jhiptser aws" on multiple macOS and Linux machines.

jhispter aws

Installing AWS dependencies into your JHipster folder
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: ERROR! Something went wrong while installing:
warning Pattern ["uuid@^3.1.0"] is trying to unpack in the same destination "/usr/local/share/.cache/yarn/v1/npm-uuid-3.1.0-3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" as pattern ["uuid@^3.0.0"]. This could result in a non deterministic behavior, skipping.
warning There appears to be trouble with your network connection. Retrying...
warning [email protected]: The platform "linux" is incompatible with this module.
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/home/supercobra/workspace/q-cloud-jhipster/node_modules/generator-jhipster/node_modules/less'".

    at Environment.error (/usr/local/share/.config/yarn/global/node_modules/yeoman-environment/lib/environment.js:140:40)
    at child.error (/usr/local/share/.config/yarn/global/node_modules/generator-jhipster/generators/generator-base.js:1682:18)
    at AwsFactory.shelljs.exec (/usr/local/share/.config/yarn/global/node_modules/generator-jhipster/generators/aws/lib/aws.js:21:39)
    at /usr/local/share/.config/yarn/global/node_modules/shelljs/src/exec.js:204:9
    at ChildProcess.exithandler (child_process.js:277:5)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

##### **Reproduce the error** Run same command: `jhipster aws`. ##### **Workaround** In some cases, running `npm install aws-sdk` before running `jhipster aws` solves the issue. ##### **JHipster Version(s)** v4.7.0 ##### **JHipster Version(s)**
[email protected] /home/supercobra/workspace/q-cloud-jhipster
└── (empty)

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.metadot.q",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "4.6.2",
    "baseName": "q",
    "packageName": "com.metadot.q",
    "packageFolder": "com/metadot/q",
    "serverPort": "8080",
    "authenticationType": "oauth2",
    "hibernateCache": "no",
    "clusteredHttpSession": false,
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "gradle",
    "enableSocialSignIn": false,
    "clientFramework": "angularX",
    "useSass": false,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling",
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "ar-ly",
      "zh-cn",
      "da",
      "nl",
      "fa",
      "fr",
      "de",
      "hi",
      "id",
      "it",
      "ja",
      "ko",
      "pl",
      "pt-br",
      "pt-pt",
      "ro",
      "ru",
      "sk",
      "sr",
      "sv",
      "th",
      "ua",
      "vi"
    ]
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions

entity SystemMessage (system_message) {
  message String required maxlength(250),
  url String maxlength(1999),
  importance Integer min(0) max(2),
  isLive Boolean,
  isClosableByUser Boolean
}



paginate SystemMessage with infinite-scroll
service SystemMessage with serviceClass
angularSuffix SystemMessage with x

Environment and Tools

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

git version 2.7.4

node: v8.4.0

npm: 5.3.0

bower: 1.8.0

gulp:
[12:44:21] CLI version 1.4.0

yeoman: 2.0.0

yarn: 0.27.5

Entity configuration(s) entityName.json files generated in the .jhipster directory

N/A

Browsers and Operating System

Linux Mint 18.2 Sonya
Linux 4.8.0-53-generic #56~16.04.1-Ubuntu SMP Tue May 16 01:18:56 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

  • [X] Checking this box is mandatory (this is just to show you read everything)
aws

Most helpful comment

probably missing install part here for Yarn:
https://github.com/jhipster/generator-jhipster/blob/master/generators/aws/lib/aws.js#L17

EDIT: forgot this comment

All 27 comments

About your environment:

  • You're using node 8.x, we recommend using an LTS version which is currently 6.x. Could you try downgrading or use jhipster devbox to confirm it is an environment issue?
  • Do you mix yarn and npm?

probably missing install part here for Yarn:
https://github.com/jhipster/generator-jhipster/blob/master/generators/aws/lib/aws.js#L17

EDIT: forgot this comment

I already tried node LTS 6.x and got the same error.

Now, I just tried jhipster devbox and got the same error:

 $ jhipster aws
Using JHipster version installed locally in current project's node_modules
Executing jhipster:aws
Options: 
Installing AWS dependencies into your JHipster folder
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: ERROR! Something went wrong while installing:
warning Pattern ["uuid@^3.1.0"] is trying to unpack in the same destination "/home/vagrant/.cache/yarn/v1/npm-uuid-3.1.0-3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" as pattern ["uuid@^3.0.0"]. This could result in a non deterministic behavior, skipping.
warning [email protected]: The platform "linux" is incompatible with this module.
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/home/vagrant/q-cloud-jhipster/node_modules/generator-jhipster/node_modules/less'".

    at Environment.error (/home/vagrant/q-cloud-jhipster/node_modules/yeoman-environment/lib/environment.js:140:40)
    at child.error (/home/vagrant/q-cloud-jhipster/node_modules/generator-jhipster/generators/generator-base.js:1610:18)
    at AwsFactory.shelljs.exec (/home/vagrant/q-cloud-jhipster/node_modules/generator-jhipster/generators/aws/lib/aws.js:21:39)
    at /home/vagrant/q-cloud-jhipster/node_modules/shelljs/src/exec.js:204:9
    at ChildProcess.exithandler (child_process.js:205:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:891:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

OK, so maybe something specific to aws. Have you tried running the command manually?

yarn add aws-sdk progress uuid --modules-folder node_modules/generator-jhipster/node_modules

It works for me:

~
yarn add v0.27.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 17 new dependencies.
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
~

Hi, could we have a better title here? Please read the guidelines

@gmarziou I get the same error running the suggested command:

 yarn add aws-sdk progress uuid --modules-folder node_modules/generator-jhipster/node_modules

@gmarziou It works with running just yarn add aws-sdk. This works both on macOS and Linux.

Do you mean yarn add aws-sdk or yarn add aws-sdk --modules-folder node_modules/generator-jhipster/node_modules ?

Can you try to find which module fails to install by running only one at a time?

yarn add progress
yarn add uuid

Or is it due to --modules-folder node_modules/generator-jhipster/node_modules option?

Running the commands like below works well:

yarn add aws-sdk
yarn add progress
yarn add uuid

then jhipster aws works as well.

Just reading our source code here those libraries should be installed automatically by the sub-generator

In fact I don't understand why you can run the commands manually, and it fails when they are run by the sub-generator... Unfortunately we cannot test anything here, as we have no AWS sponsorship (most cloud providers like Google, Heroku, Cloud Foundry give us free credits to tests... but not AWS)

The commands I asked to run manually are the ones from sub generator and that were failing. I think there is a problem in the generator with one of the libs or options. Ideally, I think all sub generators that install node modules or run external commands should be more verbose as what I did for the upgrade generator.

@jdubois There is no need to deploy to AWS to reproduce this bug. This command fails on all OS I tried before deploying to AWS: macOS, several Linux and also jhipster devbox.

I'll have a look

I confirm. I just had the problem. jhipster aws fails right away. Doing yarn add aws-sdk first works.

So maybe we should update the doc and do a check? Installing through the sub generator isn't a great idea, it's going to depend wether you use Yarn or NPM.

I think first step is to make aws sdk installation not silent, this way user can understand what's wrong and report it. Similar approach as jhipster upgrade

@gmarziou We already print the error when something goes wrong, the first post has the log in it.

The issue is that when we run yarn add aws-sdk --modules-folder node_modules/generator-jhipster/node_modules, the project's node_modules folder is emptying. You can reproduce this by:

  • jhipster
  • ls node_modules # You will see all modules
  • yarn add aws-sdk progress uuid --modules-folder node_modules/generator-jhipster/node_modules
  • ls node_modules # You will only see generator-jhipster

I couldn't find a yarn flag that does what we want. Changing the command to cd node_modules/generator-jhipster && yarn add aws-sdk progress uuid && cd ../../ works without causing the node_modules to delete.

Maybe my point was not clear: as for the upgrade my goal was to give some progress report to end user which gives more info than simply the error at the end, this applies to both yarn and npm.

Anyway, I got your other points.

What I don't get is why we need to install some modules inside node_modules/generator-jhipster/node_modules, AFAIK yarn prefers flat structure than nested one. Is it a constraint of aws-sdk?

The reason was that's how our AWS docs originally directed with npm, not a good reason 😛. I didn't know yarn add aws-sdk or npm install aws-sdk was enough, thank you.

I'm getting this issue after I try and do a yarn add aws-sdk

The error message that I get is:

jhipster aws
Executing jhipster:aws
Installing AWS dependencies into your JHipster folder
events.js:182
throw er; // Unhandled 'error' event
^

Error: ERROR! Something went wrong while installing:
warning Pattern ["uuid@^3.1.0"] is trying to unpack in the same destination "/Users/daykinandy/Library/Caches/Yarn/v1/npm-uuid-3.1.0-3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" as pattern ["uuid@^3.0.0","uuid@^3.1.0","[email protected]"]. This could result in a non deterministic behavior, skipping.
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/daykinandy/code/IntellijProjects/GardenSpace/node_modules/generator-jhipster/node_modules/less'".

@adaykin usually it does not help commenting on a closed issue just saying "I have same problem" because we know nothing about your version and environment and can't try to reproduce, more we don't know what you tried to solve it. So please at least paste the output of jhipster info here or maybe better: open a new issue with it to avoid confusion.

Hmmm...so if it's the same issue would you really want someone to open a new issue instead of reopening this one? Would be a bit of an unorthodox development process. I guess I've never seen a team operate that way before but if you can confirm, I can open a new issue if that's really what you want. Anyways here is the output of jhipster info:

`Executing jhipster:info
Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
[email protected] /Users/daykinandy/code/IntellijProjects/GardenSpace
└──  (generator-jhipster) invalid error: ENOENT: no such file or directory, open '/Users/daykinandy/code/IntellijProjects/GardenSpace/node_modules/generator-jhipster/package.json

JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.gardenspace.main",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "4.6.0",
    "baseName": "GardenSpace",
    "packageName": "com.gardenspace.main",
    "packageFolder": "com/gardenspace/main",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": false,
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "prodDatabaseType": "postgresql",
    "searchEngine": "elasticsearch",
    "messageBroker": "kafka",
    "serviceDiscoveryType": "eureka",
    "buildTool": "gradle",
    "enableSocialSignIn": true,
    "jwtSecretKey": "07646c7cfbb7eae64a48469b2f41093998e0e0b3",
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling",
      "cucumber",
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "otherModules": [
      {
        "name": "generator-jhipster-module",
        "version": "2.2.0"
      },
      {
        "name": "generator-jhipster-primeng",
        "version": "2.0.0"
      },
      {
        "name": "generator-jhipster-docker",
        "version": "2.2.0"
      },
      {
        "name": "generator-jhipster-primeng-charts",
        "version": "0.0.3"
      },
      {
        "name": "generator-jhipster-bootswatch",
        "version": "1.0.2"
      },
      {
        "name": "generator-jhipster-gitlab-ci-build-status",
        "version": "0.0.1"
      },
      {
        "name": "generator-jhipster-google-maps",
        "version": "0.0.1"
      },
      {
        "name": "generator-jhipster-angular-ui",
        "version": "0.0.2"
      },
      {
        "name": "generator-jhipster-google-analytics",
        "version": "0.0.1"
      }
    ],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "fr",
      "es"
    ]
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory

Browsers and Operating System

java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

git version 2.13.6 (Apple Git-96)

node: v8.1.3

npm: 5.1.0

bower: 1.8.0

gulp:
[12:45:55] CLI version 3.9.1

yeoman: 2.0.0

yarn: 0.27.5

Docker version 17.09.0-ce, build afdb6d4

docker-compose version 1.16.1, build 6d1ac21

Execution complete`

@adaykin Your JHipster version is v4.6.0 while this fix was released in v4.9.0

Thanks, I'll upgrade. Just assumed I was on latest but apparently I wasn't.

@adaykin jhipster info shows you're you're running JDK 9 which is not supported yet but maybe you did configure another JDK, please confirm using by running ./gradlew -v in your project folder.

You also have another error which is very surprising and that I don't understand:

[email protected] /Users/daykinandy/code/IntellijProjects/GardenSpace
└──  (generator-jhipster) invalid error: ENOENT: no such file or directory, open '/Users/daykinandy/code/IntellijProjects/GardenSpace/node_modules/generator-jhipster/package.json

Could you check whether this file really does not exist or it's a file rights issue.

Please consider also upgrading yarn as you're running a rather old version.

Hmmm...so if it's the same issue would you really want someone to open a new issue instead of reopening this one? Would be a bit of an unorthodox development process.

I probably explained it very badly, I assumed you were running a recent version and so this could not be the same issue, so opening a new issue made total sense under this assumption. As you have seen, giving us the output of jhipster info is crucial.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pascalgrimaud picture pascalgrimaud  ·  3Comments

marcelinobadin picture marcelinobadin  ·  3Comments

chegola picture chegola  ·  4Comments

pascalgrimaud picture pascalgrimaud  ·  4Comments

kaidohallik picture kaidohallik  ·  3Comments