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.51k stars 4.02k forks source link

NPM install not working (WARN tar TAR_ENTRY_ERROR EIO) when creating an app inside a docker container #16706

Closed utelemaco closed 2 years ago

utelemaco commented 2 years ago
Overview of the issue

The problem occurs when I create an app inside a docker container.

Motivation for or Use Case

Since I use different JHipster versions in different projects, I just use JHipster in a docker container (created from official JHipster images). I'm using this approach (JHipster in a docker container) for more than 2 years but recently I got a problem with the command npm install when creating an app in a docker container in a shared volume.

Reproduce the error
  1. Create a docker container from an official JHipster image (the problem began in version 7.0.1):
docker container run \
  --name jhipster.v7.3.0 \
  -v $PWD/:/home/jhipster/app \
  -d -t jhipster/jhipster:v7.3.0
  1. Inside the container, create the app:
> jhipster@0c93bf50f71f:~/app$ mkdir myAppJHipster7.3.0
> jhipster@0c93bf50f71f:~/app$ cd myAppJHipster7.3.0
> jhipster@0c93bf50f71f:~/app/myAppJHipster7.3.0$ jhipster 
INFO! Using JHipster version installed globally

        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝

                            https://www.jhipster.tech

Welcome to JHipster v7.3.0
Application files will be generated in folder: /home/jhipster/app/myAppJHipster7.3.0
 _______________________________________________________________________________________________________________

  Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/
  If you find JHipster useful, consider sponsoring the project at https://opencollective.com/generator-jhipster
 _______________________________________________________________________________________________________________

? Which *type* of application would you like to create? Monolithic application (recommended for simple projects)
? What is the base name of your application? jhipster
? Do you want to make it reactive with Spring WebFlux? No
? What is your default Java package name? com.mycompany.myapp
? Which *type* of authentication would you like to use? JWT authentication (stateless, with a token)
? Which *type* of database would you like to use? SQL (H2, PostgreSQL, MySQL, MariaDB, Oracle, MSSQL)
? Which *production* database would you like to use? PostgreSQL
? Which *development* database would you like to use? H2 with disk-based persistence
? Which cache do you want to use? (Spring cache abstraction) Ehcache (local cache, for a single node)
? Do you want to use Hibernate 2nd level cache? Yes
? Would you like to use Maven or Gradle for building the backend? Maven
? Do you want to use the JHipster Registry to configure, monitor and scale your application? No
? Which other technologies would you like to use? 
? Which *Framework* would you like to use for the client? Vue
? Do you want to generate the admin UI? Yes
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Cosmo
? Choose a Bootswatch variant navbar theme (https://bootswatch.com/)? Primary
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application English
? Please choose additional languages to install 
? Besides JUnit and Jest, which testing frameworks would you like to use? 
? Would you like to install other generators from the JHipster Marketplace? No

KeyStore 'src/main/resources/config/tls/keystore.p12' generated successfully.

   create .prettierrc
   create .prettierignore
   create .gitattributes
jsxBracketSameLine is deprecated.
...

The application is created but the command npm install that is automatically called after the generation of the file shows dozens of the following lines:

npm WARN tar TAR_ENTRY_ERROR EIO: i/o error, open '/home/jhipster/app/myAppJHipster7.3.0/node_modules/fork-ts-checker-webpack-plugin-v5/node_modules/lru-cache/index.js'
npm WARN tar TAR_ENTRY_ERROR EIO: i/o error, open '/home/jhipster/app/myAppJHipster7.3.0/node_modules/yorkie/node_modules/cross-spawn/README.md'
npm WARN tar TAR_ENTRY_ERROR EIO: i/o error, open '/home/jhipster/app/myAppJHipster7.3.0/node_modules/yorkie/node_modules/ci-info/CHANGELOG.md'
npm WARN tar TAR_ENTRY_ERROR EIO: i/o error, open '/home/jhipster/app/myAppJHipster7.3.0/node_modules/yorkie/node_modules/normalize-path/README.md'
npm WARN tar TAR_ENTRY_ERROR EIO: i/o error, open '/home/jhipster/app/myAppJHipster7.3.0/node_modules/yorkie/node_modules/lru-cache/index.js'
npm WARN tar TAR_ENTRY_ERROR EIO: i/o error, open '/home/jhipster/app/myAppJHipster7.3.0/node_modules/inquirer/node_modules/color-convert/CHANGELOG.md'
npm WARN tar TAR_ENTRY_ERROR EIO: i/o error, open '/home/jhipster/app/myAppJHipster7.3.0/node_modules/yorkie/node_modules/yallist/README.md'

In the end, the process ends up with the following error:

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /home/jhipster/app/myAppJHipster7.3.0/node_modules/@vue/cli-plugin-eslint/node_modules/acorn/bin/acorn
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/home/jhipster/app/myAppJHipster7.3.0/node_modules/@vue/cli-plugin-eslint/node_modules/acorn/bin/acorn'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jhipster/.npm/_logs/2021-10-15T20_57_33_950Z-debug.log
Error executing './npmw install', execute it yourself. (Command failed with exit code 254: ./npmw install)
Application commit to Git failed from /home/jhipster/app/myAppJHipster7.3.0. Try to commit manually.

If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Server application generated successfully.

Run your Spring Boot application:
./mvnw

Client application generated successfully.

Start your Webpack development server with:
 npm start

> jhipster@0.0.0 clean-www
> rimraf target/classes/static/app/{src,target/}

sh: 1: rimraf: not found
ERROR! Command failed with exit code 127: npm run clean-www
Error: Command failed with exit code 127: npm run clean-www
    at makeError (/home/jhipster/generator-jhipster/node_modules/execa/lib/error.js:59:11)
    at Function.module.exports.sync (/home/jhipster/generator-jhipster/node_modules/execa/index.js:188:17)
    at JHipsterClientGenerator.spawnCommand.spawnCommandSync (/home/jhipster/generator-jhipster/node_modules/yeoman-generator/lib/actions/spawn-command.js:35:16)
    at JHipsterClientGenerator.end (/home/jhipster/generator-jhipster/generators/client/index.js:407:16)
    at Object.<anonymous> (/home/jhipster/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1024:25)
    at /home/jhipster/generator-jhipster/node_modules/run-async/index.js:49:25
    at new Promise (<anonymous>)
    at /home/jhipster/generator-jhipster/node_modules/run-async/index.js:26:19
    at runLoop.add.once.once (/home/jhipster/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1025:11)
    at Immediate.<anonymous> (/home/jhipster/generator-jhipster/node_modules/grouped-queue/lib/subqueue.js:48:34) {
  shortMessage: 'Command failed with exit code 127: npm run clean-www',
  command: 'npm run clean-www',
  exitCode: 127,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Some important notes:

Related issues
Suggest a Fix
JHipster Version(s) and configuration
jhipster@0c93bf50f71f:~/app/myAppJHipster7.3.0$ jhipster info
INFO! Using JHipster version installed globally
Welcome to the JHipster Information Sub-Generator

##### **JHipster Version**

jhipster@0.0.0 /home/jhipster/app/myAppJHipster7.3.0
└── (empty)

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**

<details>
<summary>.yo-rc.json file</summary>
<pre>
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "baseName": "jhipster",
    "jhipsterVersion": "7.3.0",
    "skipClient": false,
    "skipServer": false,
    "skipUserManagement": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "testFrameworks": [],
    "blueprints": [],
    "otherModules": [],
    "pages": [],
    "creationTimestamp": 1634330371626,
    "serviceDiscoveryType": "no",
    "reactive": false,
    "authenticationType": "jwt",
    "packageName": "com.mycompany.myapp",
    "serverPort": "8080",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "buildTool": "maven",
    "serverSideOptions": [],
    "websocket": false,
    "searchEngine": false,
    "messageBroker": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "vue",
    "withAdminUi": true,
    "clientTheme": "cosmo",
    "clientThemeVariant": "primary",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "devServerPort": 9060,
    "clientPackageManager": "npm",
    "languages": ["en"],
    "enableGradleEnterprise": false
  }
}

</pre>
</details>

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

<details>
<summary>JDL entity definitions</summary>

<pre>

</pre>
</details>

##### **Environment and Tools**

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7)
OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)

git version 2.25.1

node: v14.17.6

npm: 7.24.2

No change to package.json was detected. No package manager install will be executed.
Congratulations, JHipster execution is complete!
Sponsored with ❤️  by @oktadev.
Entity configuration(s) entityName.json files generated in the .jhipster directory

N.A.

Browsers and Operating System

Browser: N.A. OS: MacOS Catalina (10.15.7) Docker engine: 20.18.8

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days

pascalgrimaud commented 2 years ago

Thanks for providing so much details I'll have a look

pascalgrimaud commented 2 years ago

@utelemaco :

I tested on my machine and everything works fine. I check our daily builds with Docker and it looks fine too: https://github.com/hipster-labs/jhipster-daily-builds/runs/4207299441

I don't have any issue, related to npm install. I have a lot of warning but it's normal (related to deprecated lib).

image

Maybe the difference is MacOS ? As I'm using Ubuntu 20.04

utelemaco commented 2 years ago

@pascalgrimaud

Thanks for checking this issue.

It seems it is a docker issue on mac os. Updating docker didn't solve the problem. So, I resolved it by removing docker and reinstalling it from scratch. I was quite reluctant to this strategy because I would lose all the images and containers I had in my machine. I tried several alternatives (using different configurations for mounting volumes, updating NPM, using unmounted directories). But in the end that was the only thing that resolved.

Cheers,

Ulisses