Le projet étant conteneurisé, il est nécessaire de créer un environnement localement. J'utilisais rubocop comme outil d'analyse statique pour Ruby, alors j'ai essayé de l'exécuter.
Environnement: MacBookPro MacOS (10.15.7)
bundle exec rubocop
-bash: /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
Ça ne bouge pas. N'utilisez plus ruby2.3. Ne mettez pas à jour ce bundle.
sudo gem update bundler
Updating installed gems
Updating bundler
Fetching bundler-2.1.4.gem
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Installing ri documentation for bundler-2.1.4
Installing darkfish documentation for bundler-2.1.4
Done installing documentation for bundler after 5 seconds
Parsing documentation for bundler-2.1.4
Done installing documentation for bundler after 2 seconds
Gems updated: bundler
Contrôle de fonctionnement
bundle -v
Bundler version 1.17.2
Oh! courir rubocop
bundle exec rubocop
bundler: command not found: rubocop
Install missing gem executables with `bundle install`
Es-tu sérieux? Je ne veux pas entrer dans le système de différentes manières, donc je me demande si j'ai spécifié bundle install --path vendor / bundle
bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
(Omission)
Installing puma 4.3.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3/ext/puma_http11
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20201102-12192-10ppsgh.rb extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
creating Makefile
current directory:
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3/ext/puma_http11
make "DESTDIR=" clean
current directory:
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
compiling mini_ssl.c
compiling puma_http11.c
puma_http11.c:203:22: error: implicitly declaring library function 'isspace'
with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
while (vlen > 0 && isspace(value[vlen - 1])) vlen--;
^
puma_http11.c:203:22: note: include the header <ctype.h> or explicitly provide a
declaration for 'isspace'
1 error generated.
make: *** [puma_http11.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3
for inspection.
Results logged to
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/puma-4.3.3/gem_make.out
An error occurred while installing puma (4.3.3), and Bundler cannot
continue.
Make sure that `gem install puma -v '4.3.3'` succeeds before bundling.
In Gemfile:
puma
Qu'est-ce qui ne va pas! Recherchez mac puma make failed
sur Google et trouvez un article comme ça
https://qiita.com/fruitriin/items/5148632d301985094b10 Selon ce qui précède
Il semble que les paramètres par défaut côté Mac ont changé et qu'il n'est pas possible de compiler avec gcc. https://github.com/puma/puma/issues/2304
Est-ce encore le travail d'Apple!
Solution de contournement pour le problème ci-dessus (https://github.com/puma/puma/issues/2304#issuecomment-664448309)
bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"
Après avoir exécuté ce qui précède, bundle install
doit être effectué.
bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
(Omission)
Installing puma 4.3.3 with native extensions
Installing rack-test 1.1.0
Installing rspec-support 3.8.2
Installing rspec-core 3.8.2
Installing rspec-expectations 3.8.4
Installing rspec-mocks 3.8.1
Installing rspec 3.8.0
Installing rubocop 0.74.0
(Ce qui suit est omis)
Enfin, rubocop est installé. Courez immédiatement!
bundle exec rubocop
Inspecting 90 files
..........................................................................................
90 files inspected, no offenses detected
Tu l'as fait!
Recommended Posts