0

I have installed a fresh Sitecore 9.2 install and I'm trying to deploy an existing react solution to my local. When I run the npm build task I get the following error.

> my-sitecore-site@1.2.0 build:client C:\dev\sites\my-sitecore-site
> cross-env-shell NODE_ENV=${NODE_ENV:-develop} PUBLIC_URL=$npm_package_config_sitecoreDistPath "craco build" && node ./build-client.js

The system cannot find the path specified.
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn Files\Git\dist\my-sitecore-site ENOENT
    at notFoundError (C:\dev\sites\my-sitecore-site\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\dev\sites\my-sitecore-site\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\dev\sites\my-sitecore-site\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.cp.emit (C:\dev\sites\my-sitecore-site\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn Files\\Git\\dist\\my-sitecore-site',
  path: 'Files\\Git\\dist\\my-sitecore-site',
  spawnargs: [ 'craco build' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-sitecore-site@1.2.0 build:client: `cross-env-shell NODE_ENV=${NODE_ENV:-develop} PUBLIC_URL=$npm_package_config_sitecoreDistPath "craco build" && node ./build-client.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-sitecore-site@1.2.0 build:client 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\my-user\AppData\Roaming\npm-cache\_logs\2021-04-01T14_27_37_138Z-debug.log
ERROR: "build:client" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-sitecore-site@1.2.0 build: `npm-run-all --serial bootstrap:connected build:client build:server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-sitecore-site@1.2.0 build 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\my-user\AppData\Roaming\npm-cache\_logs\2021-04-01T14_27_37_222Z-debug.log

It looks like it has some issues with this npm task

"build": "npm-run-all --serial bootstrap:connected build:client build:server",

and it fails on build:client.

If I run npm run build:client individually on its own it works, but when I run npm-run-all --serial bootstrap:connected build:client build:server it fails and gives me the error above.

Any help is appreciated.

Thanks!

0

I figured out the issue.

When running npm run build Git Bash was changing my file path from the projects file path (C:\dev\sites\my-sitecore-site) to where git was installed (C:\Program Files\Git).

I had to run this command in git bash set MSYS_NO_PATHCONV=1 git blame -L/pathconv/ msys2_path_conv.cc

Setting this flag stops the path conversion that is happening.

I found this solution here - https://stackoverflow.com/questions/54258996/git-bash-string-parameter-with-at-start-is-being-expanded-to-a-file-path

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.