エラー /node_modules/node-sass: コマンドが失敗しました 質問する

エラー /node_modules/node-sass: コマンドが失敗しました 質問する

ローカルに vue store front をインストールしようとしましたが、「yarn install」コマンドを実行すると次のエラーが発生します。このエラーを解決するにはどうすればよいですか? このエラーを解決するにはどうすればよいですか?

error /var/www/html/vue-storefront/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /var/www/html/vue-storefront/node_modules/node-sass
Output:
Building: /usr/bin/node /var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/bin/node',
gyp verb cli   '/var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "/usr/bin/python3.6" in the PATH
gyp verb `which` succeeded /usr/bin/python3.6 /usr/bin/python3.6
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/bin/python3.6 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:303:12)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1026:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
gyp ERR! System Linux 4.15.0-88-generic
gyp ERR! command "/usr/bin/node" "/var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /var/www/html/vue-storefront/node_modules/node-sass
gyp ERR! node -v v13.9.0

ベストアンサー1

私も同じ問題を抱えていましたが、次の手順で解決しました:

  1. Apple M1チップを使用している場合は、ターミナルを実行しますRosetta 2(オプション、Rosettaでノードがインストールされている場合にのみ必要)
  2. node-sassバージョンを確認しpackage.json、次の表と比較してください。
ノードJS サポートされている node-sass バージョン ノードモジュール
ノード20 9.0以上 115
ノード 19 8.0以上 111
ノード 18 8.0以上 108
ノード 17 7.0以上、8.0未満 102
ノード 16 6.0以上 93
ノード 15 5.0以上 88
ノード 14 4.14以上 83
ノード13 4.13以上、<5.0 79
ノード 12 4.12以上 72
ノード11 4.10以上、<5.0 67
ノード10 4.9以上、<6.0 64
ノード8 4.5.3+、<5.0 57
ノード <8 <5.0 <57
  1. Node のバージョンを確認するには、以下を実行します。node --version
  2. お使いの環境に応じて Nodejs のバージョンをインストールしますnode-sass。NVM を使用している場合は、次を実行します。nvm use DESIRED_VERSION
  3. 古いnode_modulesフォルダを削除するか、ターミナルで次のように入力します。rm -rf node_modules
  4. 走る:npm install

リソース:

おすすめ記事