jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.35k stars 4.01k forks source link

Node-gyp failed to builid 'make' failed with exit code 2 #11225

Closed TLBSoftware closed 4 years ago

TLBSoftware commented 4 years ago
Overview of the issue

When running jhipster and installing angular the npm install fails to run node-gyp rebuild do to the fsevents version

Motivation for or Use Case

When generating the application you get a bunch of errors on the npm install

Reproduce the error

jhipster generate a project using angular and then run npm install

Suggest a Fix

It appears that the @angular-cli has chokidar as a dependency that includes a version of fsevents that triggers this issue, I found that if you install fsevents@1.2.9 it fixes the issue since that package includes a binary for macosx

https://github.com/fsevents/fsevents/issues/302#issuecomment-570781629

JHipster Version(s)

5.8.0

JHipster configuration

INFO! Using JHipster version installed locally in current project's node_modules INFO! Executing jhipster:info INFO! Options: from-cli: true

JHipster Version(s)
workout-tracker@0.0.0 /Users/<username redacted>/Documents/Projects/at_home_projects/workout_tracker_mono/workout_tracker
└── generator-jhipster@5.8.0 
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
    "generator-jhipster": {
        "promptValues": {
            "packageName": "com.tlbsoftware.workout_tracker"
        },
        "jhipsterVersion": "5.8.0",
        "applicationType": "monolith",
        "baseName": "workout_tracker",
        "packageName": "com.tlbsoftware.workout_tracker",
        "packageFolder": "com/tlbsoftware/workout_tracker",
        "serverPort": "8080",
        "authenticationType": "jwt",
        "cacheProvider": "ehcache",
        "enableHibernateCache": true,
        "websocket": false,
        "databaseType": "sql",
        "devDatabaseType": "postgresql",
        "prodDatabaseType": "postgresql",
        "searchEngine": false,
        "messageBroker": false,
        "serviceDiscoveryType": false,
        "buildTool": "maven",
        "enableSwaggerCodegen": false,
        "jwtSecretKey": ,
        "clientFramework": "angularX",
        "useSass": true,
        "clientPackageManager": "npm",
        "testFrameworks": [],
        "jhiPrefix": "jhi",
        "entitySuffix": "",
        "dtoSuffix": "DTO",
        "otherModules": [],
        "enableTranslation": false
    }
}

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

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.21.0 (Apple Git-122.2)

node: v10.15.0

npm: 6.13.4

yarn: 1.13.0

Docker version 18.09.2, build 6247962

docker-compose version 1.23.2, build 1110ad01

INFO! Congratulations, JHipster execution is complete!

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

This error is during the initial generation without any jdl's

Browsers and Operating System

Macosx 10.14.6

TLBSoftware commented 4 years ago

It also appears that this causes the generator to not successfully run the CREATE DATABASE command requiring the user to do that step too

vishal423 commented 4 years ago

@TLBSoftware, can you try against latest released version v6.6.0?

PierreBesson commented 4 years ago

Usually this kind of problems are fixed by running npm rebuild

pascalgrimaud commented 4 years ago

As asked, try to use the last release of JHipster v6.6.0 Then, upgrade to the last version of Node LTS too, yours is old

I'm closing this as I'm pretty sure it's an environment issue

TLBSoftware commented 4 years ago

I am experiencing the same issue after upgrading jhipster, and upgrading to use node v12.14.1 and the new version of npm

INFO! Using JHipster version installed locally in current project's node_modules INFO! Executing jhipster:info INFO! Options: from-cli: true

JHipster Version(s)
workout-tracker-mono@0.0.0 /Users/taylorbryant/Documents/Projects/at_home_projects/workout_tracker_mono
└── generator-jhipster@5.8.0 
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
    "generator-jhipster": {
        "promptValues": {
            "packageName": "com.tlbsoftware.workout_tracker"
        },
        "jhipsterVersion": "5.8.0",
        "applicationType": "monolith",
        "baseName": "workout_tracker_mono",
        "packageName": "com.tlbsoftware.workout_tracker",
        "packageFolder": "com/tlbsoftware/workout_tracker",
        "serverPort": "8080",
        "authenticationType": "jwt",
        "cacheProvider": "ehcache",
        "enableHibernateCache": true,
        "websocket": false,
        "databaseType": "sql",
        "devDatabaseType": "postgresql",
        "prodDatabaseType": "postgresql",
        "searchEngine": false,
        "messageBroker": false,
        "serviceDiscoveryType": false,
        "buildTool": "maven",
        "enableSwaggerCodegen": false,
        "clientFramework": "angularX",
        "useSass": true,
        "clientPackageManager": "npm",
        "testFrameworks": [],
        "jhiPrefix": "jhi",
        "entitySuffix": "",
        "dtoSuffix": "DTO",
        "otherModules": [],
        "enableTranslation": false
    }
}

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

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.21.0 (Apple Git-122.2)

node: v12.14.1

npm: 6.13.7

yarn: 1.13.0

Docker version 18.09.2, build 6247962

docker-compose version 1.23.2, build 1110ad01

INFO! Congratulations, JHipster execution is complete!

Again the npm install fails when node-gyp rebuild is ran for the fsevents@1.2.11

Npm output:

fsevents@1.2.11 install /Users/taylorbryant/Documents/Projects/at_home_projects/workout_tracker_mono/node_modules/fsevents node-gyp rebuild


SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
audited 64126 packages in 8.631s

In file included from ../fsevents.cc:6: In file included from ../../nan/nan.h:53: In file included from /Users/taylorbryant/Library/Caches/node-gyp/12.14.1/include/node/uv.h:66: In file included from /Users/taylorbryant/Library/Caches/node-gyp/12.14.1/include/node/uv/unix.h:59: In file included from /Users/taylorbryant/Library/Caches/node-gyp/12.14.1/include/node/uv/darwin.h:26: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/mach.h:66: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/mach_types.h:80: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/host_info.h:66: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/message.h:308:2: error: unknown type name 'uint64_t' uint64_t address; ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/message.h:340:2: error: unknown type name 'uint64_t' uint64_t address; ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/message.h:371:2: error: unknown type name 'uint64_t' uint64_t context; ^ In file included from ../fsevents.cc:6: In file included from ../../nan/nan.h:53: In file included from /Users/taylorbryant/Library/Caches/node-gyp/12.14.1/include/node/uv.h:66: In file included from /Users/taylorbryant/Library/Caches/node-gyp/12.14.1/include/node/uv/unix.h:59: In file included from /Users/taylorbryant/Library/Caches/node-gyp/12.14.1/include/node/uv/darwin.h:26: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/mach.h:66: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/mach_types.h:80: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/host_info.h:67: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/vm_statistics.h:137:2: error: unknown type name 'uint64_t' uint64_t zero_fill_count; / # of zero fill pages / ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [Release/obj.target/fse/fsevents.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/taylorbryant/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:223:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Darwin 18.7.0 gyp ERR! command "/Users/taylorbryant/.nvm/versions/node/v12.14.1/bin/node" "/Users/taylorbryant/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/taylorbryant/Documents/Projects/at_home_projects/workout_tracker_mono/node_modules/fsevents gyp ERR! node -v v12.14.1 gyp ERR! node-gyp -v v5.0.7 gyp ERR! not ok npm WARN acorn-dynamic-import@4.0.0 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself. npm WARN bootstrap@4.2.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself. npm WARN bootstrap@4.2.1 requires a peer of popper.js@^1.14.6 but none is installed. You must install peer dependencies yourself. npm WARN ngx-webstorage@2.0.1 requires a peer of @angular/core@^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: node-gyp rebuild npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

27 packages are looking for funding run npm fund for details

found 97 vulnerabilities (75 low, 13 moderate, 8 high, 1 critical) run npm audit fix to fix them, or npm audit for details

TLBSoftware commented 4 years ago

It is a direct issue with the included fsevents you all use (from angular -> chokidar), as stated in my first post if I install fsevents@1.2.9 which includes a macosx binary this error does not exist

TLBSoftware commented 4 years ago

tried an npm rebuild and then nuked the whole project and tried generating again but it still fails

TLBSoftware commented 4 years ago

@pascalgrimaud I ended up running into this again in another project (ionic v4) and found this stack overflow answer to fix the issue https://stackoverflow.com/a/47401866/6181337