Skip to content

npm install fails: ModuleNotFoundError: No module named 'distutils' #195

Open
@sebastienbarbier

Description

When running npm i on a fresh install, npm return an error when install node-sass.

node-sass is deprecated and should be replaced by sass.

The following issue occurs>

npm ERR! ModuleNotFoundError: No module named 'distutils'
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/sbarbier/dev/git/seven23/node_modules/node-gyp/lib/configure.js:259:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:518:28)

To temporarily avoid that issue, a solution consist in creating a python virtual env in the project and install setuptools locally:

python3 -m venv apps
source apps/bin/activate
python3 -m pip install setuptools

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions