mardi 3 août 2021

How to solve "npm ERR! code 1" when running npm install

I'm getting npm ERR! code 1 when running n`pm install in a Laravel Project, specificly with this npm ERR! path C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\node-sass npm ERR! command failed

Laravel version: 5.2

I've tried with:

  • Node v14., v12.2., v11.*
  • NPM vlatests, NPM v6.*

I've tried almost every solution in stack overflow forums, cleaning npm cache, removing .lock files, cleaning composer cache, composer autoload, etc... nothing works

Here's the output code

    npm ERR! code 1
npm ERR! path C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\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:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\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:\\xampp\\htdocs\\Fiver ' +
npm ERR! gyp verb cli     'Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\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@12.2.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:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:148:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2     
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:148:21) {
npm ERR! gyp verb `which` failed   stack: 'Error: not found: python2\n  
  at getNotFoundError (C:\\xampp\\htdocs\\Fiver ' +
npm ERR! gyp verb `which` failed     'Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\node_modules\\which\\which.js:13:12)\n' +
npm ERR! gyp verb `which` failed     '    at F (C:\\xampp\\htdocs\\Fiver ' +
npm ERR! gyp verb `which` failed     'Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\node_modules\\which\\which.js:68:19)\n' +
npm ERR! gyp verb `which` failed     '    at E (C:\\xampp\\htdocs\\Fiver ' +
npm ERR! gyp verb `which` failed     'Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\node_modules\\which\\which.js:80:29)\n' +
npm ERR! gyp verb `which` failed     '    at C:\\xampp\\htdocs\\Fiver ' 
+
npm ERR! gyp verb `which` failed     'Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\node_modules\\which\\which.js:89:16\n' 
+
npm ERR! gyp verb `which` failed     '    at C:\\xampp\\htdocs\\Fiver ' 
+
npm ERR! gyp verb `which` failed     'Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\node_modules\\isexe\\index.js:42:5\n' +npm ERR! gyp verb `which` failed     '    at C:\\xampp\\htdocs\\Fiver ' 
+
npm ERR! gyp verb `which` failed     'Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\node_modules\\isexe\\windows.js:36:5\n' +
npm ERR! gyp verb `which` failed     '    at FSReqCallback.oncomplete (fs.js:148: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` succeeded python C:\Python38\python.EXE       
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python38\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                       ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (child_process.js:304:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:196:13)     
npm ERR! gyp ERR! stack     at maybeClose (internal/child_process.js:1011:16)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:268:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\xampp\\htdocs\\Fiver Projects\\yuryhoyos\\Backend\\rakzodia-ethos-backend-7128da03c67c\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\xampp\htdocs\Fiver Projects\yuryhoyos\Backend\rakzodia-ethos-backend-7128da03c67c\node_modules\node-sass
npm ERR! gyp ERR! node -v v12.2.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\javie\AppData\Local\npm-cache\_logs\2021-08-04T03_07_28_962Z-debug.log

Here's the package.json

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "laravel-elixir": "^5.0.0",
    "bootstrap-sass": "^3.0.0"
  }
}

Here's the composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

Any ideas of how can I solve it??



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire