0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Jenkinsビルド実行時にnpmエラー

Posted at
  • rails 7.1
  • vite
  • Jenkinsfile

上記な環境でJenkinsのビルドを実行すると、以下のようなエラーに遭遇する。

ActionView::Template::Error: Vite Ruby can't find entrypoints/application.js in the manifests.

Possible causes:
  - The last build failed. Try running `bin/vite build --clear --mode=test` manually and check for errors.

Errors:
  npm error code EACCES
  npm error syscall mkdir
  npm error path /.npm
  npm error errno EACCES
  npm error
  npm error Your cache folder contains root-owned files, due to a bug in
  npm error previous versions of npm which has since been addressed.
  npm error
  npm error To permanently fix this problem, please run:
  npm error   sudo chown -R XXX:XXX "/.npm"
  npm error Log files were not written due to an error writing to the directory: /.npm/_logs
  npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal


Visit the Troubleshooting guide for more information:
  https://vite-ruby.netlify.app/guide/troubleshooting.html#troubleshooting

Jenkinsfileファイルを以下のようにすることで解消した。

      environment {
        RAILS_ENV = 'test'
        NPM_CONFIG_CACHE = "${WORKSPACE}/.npm"
      }
      steps {
        sh 'bundle exec vite install'
        sh 'bin/vite build --clear --mode=test'
        sh 'bundle exec rails test'
      }
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?