Next.js: npm ERR! spawn = ENOENT error when installing 6-fetching-data example

Created on 9 Feb 2020  路  11Comments  路  Source: vercel/next.js

Bug report

Describe the bug

Hi, I have follow the instructions on the Next.js tutorial Fetching Data for Pages but when I run the command npm install I get the following error output:

npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

> [email protected] postinstall C:\src\next-learn-demo\6-fetching-data\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn =
npm ERR! file =
npm ERR! path =
npm ERR! errno ENOENT
npm ERR! [email protected] postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn = ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\SiriusFuenmayor\AppData\Roaming\npm-cache\_logs\2020-02-08T22_54_44_554Z-debug.log

The detailed log is attached

2020-02-09T00_03_45_665Z-debug.log

To Reproduce

Steps to reproduce the behavior:

On Windows 10 using PowerShell and Node.js version 12.15.0 run the following commands:

git clone https://github.com/zeit/next-learn-demo.git
cd next-learn-demo
cd 6-fetching-data
npm install

System information

  • OS: Windows 10
  • Browser: Firefox
  • Version of Next.js:
    "dependencies": {
    "next": "latest",
    "react": "^16.12.0",
    "react-dom": "^16.12.0"
    }

Most helpful comment

@SiriusFuenmayor hmm ok, the only relevant issue might be this one: https://github.com/facebook/create-react-app/issues/8441#issuecomment-583197435

npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"

Alternatively you could check if your ComSpec or PATH enviromental variables includes C:\Program Files (x86)\git\bin\bash.exe' value and replace it with path to your actual shell executable

All 11 comments

Tried to solve by deleting all npm packages, cleaning npn cache, reinstalling Node.js and the problem persists. I have also tried to use cmd instead of Windows Powershell with no success

This is a problem only with Windows 10 because I have follow the instructions in Ubuntu and everything works fine. I do not have the experience to figure out what is happening, I have tried with the LTS version of Node and the lastest version and nothing works. If someone knows the cause I will appreciate its help.

@SiriusFuenmayor I tried to Google for your error but couldn't find similar errors... Could you try using Git Bash and see if that solves it? https://gitforwindows.org/

Hi, yes let me try and I will tell you

same error

Screenshot (34)

@SiriusFuenmayor hmm ok, the only relevant issue might be this one: https://github.com/facebook/create-react-app/issues/8441#issuecomment-583197435

npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"

Alternatively you could check if your ComSpec or PATH enviromental variables includes C:\Program Files (x86)\git\bin\bash.exe' value and replace it with path to your actual shell executable

Thank you so much for your time @chibicode, let me see if it works.

Hi @chibicode your solution works, thank you!

@SiriusFuenmayor great! thank you!

@SiriusFuenmayor great! thank you! it help me save a lot of time

How could I fix the same problem in Mac?

Was this page helpful?
0 / 5 - 0 ratings