將線上的專案 git clone 重新部署到本地的時候(第一次部署到本地OK的,第二次部署到本地另一個位置出問題了),在 laradock 環境中 composer install 安裝OK,然後 安裝vue 環境,執行 npm install 或者 yarn install 的時候,出錯:
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (/var/www/send/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/var/www/send/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/var/www/send/node_modules/which/which.js:80:29)
gyp verb `which` failed at /var/www/send/node_modules/which/which.js:89:16
gyp verb `which` failed at /var/www/send/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /var/www/send/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (/var/www/send/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/var/www/send/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/var/www/send/node_modules/which/which.js:80:29)
gyp verb `which` failed at /var/www/send/node_modules/which/which.js:89:16
gyp verb `which` failed at /var/www/send/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /var/www/send/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed stack:
gyp verb `which` failed 'Error: not found: python2\n at getNotFoundError (/var/www/send/node_modules/which/which.js:13:12)\n at F (/var/www/send/node_modules/which/which.js:68:19)\n at E (/var/www/send/node_modules/which/which.js:80:29)\n at /var/www/send/node_modules/which/which.js:89:16\n at /var/www/send/node_modules/isexe/index.js:42:5\n at /var/www/send/node_modules/isexe/mode.js:8:5\n at FSReqWrap.oncomplete (fs.js:154:21)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed at getNotFoundError (/var/www/send/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/var/www/send/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/var/www/send/node_modules/which/which.js:80:29)
gyp verb `which` failed at /var/www/send/node_modules/which/which.js:89:16
gyp verb `which` failed at /var/www/send/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /var/www/send/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed python { Error: not found: python
gyp verb `which` failed at getNotFoundError (/var/www/send/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/var/www/send/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/var/www/send/node_modules/which/which.js:80:29)
gyp verb `which` failed at /var/www/send/node_modules/which/which.js:89:16
gyp verb `which` failed at /var/www/send/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /var/www/send/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed stack:
gyp verb `which` failed 'Error: not found: python\n at getNotFoundError (/var/www/send/node_modules/which/which.js:13:12)\n at F (/var/www/send/node_modules/which/which.js:68:19)\n at E (/var/www/send/node_modules/which/which.js:80:29)\n at /var/www/send/node_modules/which/which.js:89:16\n at /var/www/send/node_modules/isexe/index.js:42:5\n
at /var/www/send/node_modules/isexe/mode.js:8:5\n at FSReqWrap.oncomplete (fs.js:154:21)',
gyp verb `which` failed code: 'ENOENT' }
出現了很多 python , python2 什麼的。。。
或者在上面出錯的情況下,編譯本地檔案執行 npm run watch-poll (或 npm run dev) 的時候,出現另一種錯誤:
ERROR in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--5-4!./node_modules/sass-loader/lib/loader.js??ref--5-5!./resources/assets/frontend/sass/app.scss
Module build failed: Error: Missing binding /var/www/send/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x
Found bindings for the following environments:
- Linux 64-bit with Node.js 10.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (/var/www/send/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/var/www/send/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.sassLoader (/var/www/send/node_modules/sass-loader/lib/loader.js:46:72)
@ ./resources/assets/frontend/sass/app.scss 4:14-278
@ multi ./resources/assets/frontend/js/app.js ./resources/assets/frontend/sass/app.scss
ERROR in ./resources/assets/frontend/sass/app.scss
Module build failed: ModuleBuildError: Module build failed: Error: Missing binding /var/www/send/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x
Found bindings for the following environments:
- Linux 64-bit with Node.js 10.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (/var/www/send/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/var/www/send/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.sassLoader (/var/www/send/node_modules/sass-loader/lib/loader.js:46:72)
at runLoaders (/var/www/send/node_modules/webpack/lib/NormalModule.js:195:19)
at /var/www/send/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /var/www/send/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at runSyncOrAsync (/var/www/send/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
at iterateNormalLoaders (/var/www/send/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at /var/www/send/node_modules/loader-runner/lib/LoaderRunner.js:202:4
at /var/www/send/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:70:14
at process._tickCallback (internal/process/next_tick.js:61:11)
@ ./resources/assets/frontend/sass/app.scss
@ multi ./resources/assets/frontend/js/app.js ./resources/assets/frontend/sass/app.scss
根據提示 npm install node-sass 或 yarn add node-sass 無效。。。
解決辦法:
更換 npm 映象為阿里映象:
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install node-sass
本作品採用《CC 協議》,轉載必須註明作者和本文連結