Please help me figure it out? An error occurs when creating a vue project.
I am showing just what I chose when creating a vue project. I can't understand why the error is coming out. And i'm showing the configuration VS CODE.
I am showing just what I chose when creating a vue project. I can't understand why the error is coming out. And i'm showing the configuration VS CODE.
$ vue create myapp
Vue CLI v4.5.13
? Please pick a preset: Manually select features
? Check the features needed for your project: (Press <space> to select, <a> to? Check the features needed for your project: Choose Vue version, Babel, CSS P
re-processors, Linter
? Choose a version of Vue.js that you want to start the project with (Use arro? Choose a version of Vue.js that you want to start the project with 2.x
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supporte? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supporte? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supporte
d by default): Sass/SCSS (with node-sass)
? Pick a linter / formatter config: Airbnb
? Pick additional lint features: (Press <space> to select, <a> to toggle all,
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated con
fig files
? Save this as a preset for future projects? No
npm ERR! code 1
npm ERR! path C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'C:\\vue-projects\\Ud\\0 fifth VUE JS\\myapp\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.0.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:194:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the
PATH
npm ERR! gyp verb `which` failed Error: not found: python
npm ERR! gyp verb `which` failed at getNotFoundError (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp verb `which` failed python Error: not found: python
npm ERR! gyp verb `which` failed at getNotFoundError (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:194:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb could not find "python". checking python launcher
npm ERR! gyp verb could not find "python". guessing location
npm ERR! gyp verb ensuring that file exists: C:\Python27\python.exe
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can
set the PYTHON env variable.
npm ERR! gyp ERR! stack at PythonFinder.failNoPython (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack at callback (C:\vue-projects\Ud\0 fifth
VUE JS\myapp\node_modules\graceful-fs\polyfills.js:299:20)
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp ERR! System Windows_NT 6.3.9600
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\vue-projects\\Ud\\0 fifth VUE JS\\myapp\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\vue-projects\Ud\0 fifth VUE JS\myapp\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.0.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ulys\AppData\Local\npm-cache\_logs\2021-09-13T20_23_21_730Z-debug.log
ERROR command failed: npm install --loglevel error --legacy-peer-deps
This is my VS CODE config:
{
"liveSassCompile.settings.generateMap": false,
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"autoprefix": "last 5 versions",
"extensionName": ".css",
"savePath": "css"
}
],
"javascript.suggest.names": false,
"editor.lineHeight": 16,
"editor.renderWhitespace": "all",
"editor.tabSize": 2,
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"vue-html": "html"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"vue",
"html",
],
"emmet.triggerExpansionOnTab": true,
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"files.eol": "\n",
"terminal.integrated.fontSize": 12,
"workbench.startupEditor": "none",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.trimTrailingWhitespace": true,
"editor.minimap.enabled": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"diffEditor.ignoreTrimWhitespace": true,
"window.titleBarStyle": "custom",
"breadcrumbs.enabled": false,
"editor.fontLigatures": true,
"gitlens.views.repositories.location": "scm",
"gitlens.views.fileHistory.location": "gitlens",
"gitlens.views.lineHistory.location": "gitlens",
"gitlens.views.compare.location": "gitlens",
"gitlens.views.search.location": "gitlens",
"workbench.activityBar.visible": true,
"workbench.statusBar.visible": true,
"workbench.editor.showTabs": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500,
"eslint.alwaysShowStatus": true,
"eslint.autoFixOnSave": true,
"npm.enableScriptExplorer": true,
"editor.largeFileOptimizations": false,
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"terminal.external.windowsExec": "C:\\Program Files\\Git\\bin\\bash.exe",
"terminal.integrated.defaultProfile.windows": "Git Bash",
"editor.wordWrap": "on"
}
CodePudding user response:
The error is a side effect of installing node-sass
(i.e., selecting CSS Pre-processors
, and Sass/SCSS (with node-sass)
) without Python installed.
node-sass
's postinstall
uses node-gyp
, which requires Python, so if you don't have the python
binary available in the environment path, the postinstall
fails.
node-sass
is not part of the default preset, so you wouldn't see the error installing the default.
Solution 1
Install Python. The package installers usually add the python
binary to the environment path. Make sure to restart any open terminals to pick up the updated environment.
Solution 2
Use Vue CLI 5.x, which replaces node-sass
(deprecated) with sass
.
You can upgrade to 5.0.0-beta.3
(tagged next
) with:
npm i -g @vue/cli@next
Or run it with npx
:
npx @vue/cli@next create my-vue-project