$npm_execpath' is not recognized as an internal or external command

Viewed 11

Getting below error while installing webpack-cli on Windows machine

npx webpack --config ./webpack/staging/app.js
CLI for webpack must be installed.
  webpack-cli (https://github.com/webpack/webpack-cli)

We will use "yarn" to install the CLI via "yarn add -D webpack-cli".
Do you want to install 'webpack-cli' (yes/no): yes
Installing 'webpack-cli' (running 'yarn add -D webpack-cli')...
$ $npm_execpath --silent run checkyarn
'$npm_execpath' is not recognized as an internal or external command,
operable program or batch file.

Below is the package.json file

scripts {
        ...
        "preinstall": "$npm_execpath --silent run checkyarn", 
        ...
 
}

If I change $npm_execpath in package.json to %npm_execpath%

scripts {
        ...
        "preinstall": "%npm_execpath% --silent run checkyarn", 
        ... 
}

I am getting below error.

%npm_execpath% --silent run checkyarn
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
undefined
0 Answers
Related