aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 821 forks source link

Post installation script fails to run for @aws-amplify/cli@4.31.0 when path contains whitespace #5673

Closed 9710willy closed 4 years ago

9710willy commented 4 years ago

Describe the bug If you attempt to upgrade aws-amplify to version 4.31.0 with a path that contains whitespace, it will fail; then amplify-cli will not be usable. I had no problems upgrading up until now! Thanks for all your hard work 👍

Amplify CLI Version 4.30.0

To Reproduce run npm i -g @aws-amplify/cli

Expected behavior Successful upgrade to 4.30.0 -> 4.31.0

Screenshots image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

mattk- commented 4 years ago

This is also affects builds on aws/codebuild/standard:4.0 image, without whitespace in the path:


> @aws-amplify/cli@4.31.0 postinstall /usr/local/lib/node_modules/@aws-amplify/cli
178 | > node scripts/post-install.js
179 |  
180 | /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/index.js:205
181 | throw error;
182 | ^
183 |  
184 | Error: Command failed with exit code 1: /usr/local/lib/node_modules/@aws-amplify/cli/bin/amplify post-install
185 | Scanning for plugins...
186 | Plugin scan failed.
187 | Plugin scan failed.
188 | Error: Plugin scan failed.
189 | at scan (/usr/local/lib/node_modules/@aws-amplify/cli/lib/plugin-manager.js:141:15)
190 | at makeError (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/lib/error.js:59:11)
191 | at Function.module.exports.sync (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/index.js:188:17)
192 | at Function.module.exports.commandSync (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/index.js:227:15)
193 | at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/scripts/post-install.js:23:9)
194 | at Module._compile (internal/modules/cjs/loader.js:1138:30)
195 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
196 | at Module.load (internal/modules/cjs/loader.js:986:32)
197 | at Function.Module._load (internal/modules/cjs/loader.js:879:14)
198 | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
199 | at internal/main/run_main_module.js:17:47 {
200 | shortMessage: 'Command failed with exit code 1: /usr/local/lib/node_modules/@aws-amplify/cli/bin/amplify post-install',
201 | command: '/usr/local/lib/node_modules/@aws-amplify/cli/bin/amplify post-install',
202 | exitCode: 1,
203 | signal: undefined,
204 | signalDescription: undefined,
205 | stdout: 'Scanning for plugins...\n' +
206 | 'Plugin scan failed.\n' +
207 | 'Plugin scan failed.\n' +
208 | 'Error: Plugin scan failed.\n' +
209 | '    at scan (/usr/local/lib/node_modules/@aws-amplify/cli/lib/plugin-manager.js:141:15)',
210 | stderr: '',
211 | failed: true,
212 | timedOut: false,
213 | isCanceled: false,
214 | killed: false
215 | }
216
edwardfoyle commented 4 years ago

Hi @9710willy thanks for reporting this, we're investigating now. In the meantime, the CLI should actually still be usable even though the installation failed. The only features affected by the post-install script are local mocking. Hope this unblocks you for now.

ghost commented 4 years ago

Also failing on Debian:

@aws-amplify/cli@4.31.0 postinstall /usr/local/lib/node_modules/@aws-amplify/cli node scripts/post-install.js

/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/index.js:205 throw error; ^

Error: Command failed with exit code 1: /usr/local/lib/node_modules/@aws-amplify/cli/bin/amplify post-install ┌───────────────────────────────────────────────────┐ │ @aws-amplify/cli update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /root/.config │ └───────────────────────────────────────────────────┘ Scanning for plugins... Plugin scan failed. Plugin scan failed. Error: Plugin scan failed. at scan (/usr/local/lib/node_modules/@aws-amplify/cli/lib/plugin-manager.js:141:15) at makeError (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/lib/error.js:59:11) at Function.module.exports.sync (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/index.js:188:17) at Function.module.exports.commandSync (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/execa/index.js:227:15) at Object. (/usr/local/lib/node_modules/@aws-amplify/cli/scripts/post-install.js:23:9) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/@aws-amplify/cli/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"ia32"}) npm WARN ws@7.3.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself. npm WARN ws@7.3.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @aws-amplify/cli@4.31.0 postinstall: node scripts/post-install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @aws-amplify/cli@4.31.0 postinstall script.

edwardfoyle commented 4 years ago

@mattk- @TonyAsbestosAlert after the installation fails, are you able to run amplify plugin scan? Or do you get the same error?

edwardfoyle commented 4 years ago

Also @mattk- @TonyAsbestosAlert did you install the cli using sudo?

ghost commented 4 years ago
  1. I installed using sudo
  2. After the install fails, there is no amplify command installed to run!
kaustavghosh06 commented 4 years ago

@TonyAsbestosAlert Got it. We've reverted the change and if you re-run npm install -g @aws-amplify/cli - the CLI should install correctly.

edwardfoyle commented 4 years ago

This issue has been fixed in CLI version 4.31.1. If you installed version 4.31.0 using sudo, you may need to sudo remove the .amplify/lib folder before installing the latest version:

sudo rm -rf ~/.amplify/lib
ghost commented 4 years ago

Thanks Edward, successfully installed on Debian.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.