简体   繁体   中英

amplify publish keeps failing with spawn npm.cmd ENOENT error

Amplify works fine when I do api, auth changes etc. I can do amplify pull/push and everything else using amplify cli. When I try to publish it, I get this error

放大发布错误

My build works file. Everything in the aws amplify console is good. I'm not sure what the error is here. Here is my system config

ubuntu 20.04 
amplify 4.51.0
node 14.15.2
npm 7.12.1

It works perfectly fine for my colleague whose config is

Windows 10
amplify 4.46.1
node 14.15.0
npm 6.13.7

Any idea what might be the problem here? I'm guessing it has something to do with me using Ubuntu and my colleague using Windows. It used to work fine before until my colleague started working on the same project. Any idea how I can fix this?

It did have something to do with the OS. In Windows the build and start commands are set as

"BuildCommand": "npm.cmd run-script build",
"StartCommand": "npm.cmd run-script start"

The.cmd applies only for windows. So I ran amplify configure project and changed the commands to

"BuildCommand": "npm run-script build",
"StartCommand": "npm run-script start"

This solved the issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM