amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

error when i do awsmobile pull #123

Open stevemao opened 6 years ago

stevemao commented 6 years ago
awsmobile project's access information copied to: src/aws-exports.js
contents in #current-backend-info/ is synchronized with the latest in the aws cloud
? sync corresponding contents in backend/ with #current-backend-info/ Yes
(node:82217) UnhandledPromiseRejectionWarning: Error: EEXIST: file already exists, symlink '../mime/cli.js' -> '/Users/stevemao/workdir/news/awsmobilejs/backend/cloud-api/Posts/node_modules/.bin/mime'

Any idea why?

UnleashedMind commented 6 years ago

We are investigating this issue. This happens at the last step of the pull, the cli is updating the backend (your development) contents with the latest. So the contents in the #current-backend-info is already sync'ed up with the cloud.

UnleashedMind commented 6 years ago

What is your cli and node version? I was not able to reproduce this error, with the same symlink in the node_modules/.bin folder.

stevemao commented 6 years ago
$ node -v
v10.0.0

$ npm -v
6.0.0

I tried

$ node -v
v6.10.3

$ npm -v
6.0.0

It gave me the same result.

My system: macOS High Sierra 10.13.2

My dependencies in one of the cloud apis:

"dependencies": {
    "amazon-cognito-identity-js": "^1.16.0",
    "aws-sdk": "^2.49.0",
    "aws-serverless-express": "^3.2.0",
    "body-parser": "^1.17.1",
    "elasticsearch": "^14.2.2",
    "express": "^4.15.2",
    "http-aws-es": "^4.0.0"
  },
  "devDependencies": {},
UnleashedMind commented 6 years ago

the cli only works for node version 7+, so node version 6.* is not a good choice. Could you please try to use node version 8.9.0? That's the version that's been extensively tested. We haven't tested on node version 10.0.0 yet.

stevemao commented 6 years ago

I will switch to v8.9.0 and let you know.

Sent from my iPhone

On 8 May 2018, at 4:53 am, UnleashedMind notifications@github.com wrote:

the cli only works for node version 7+, so node version 6.* is not a good choice. Could you please try to use node version 8.9.0? That's the version that's been extensively tested. We haven't tested on node version 10.0.0 yet.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

stevemao commented 6 years ago

I just tried it gives me the same result

$ npm version
{ 
  npm: '6.0.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.7.0',
  icu: '60.1',
  modules: '57',
  nghttp2: '1.25.0',
  node: '8.10.0',
  openssl: '1.0.2n',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.50',
  zlib: '1.2.11' }
retrieving the latest backend awsmobile project information
awsmobile project's details logged at:
    awsmobilejs/#current-backend-info/backend-details.json
awsmobile project's specifications logged at:
    awsmobilejs/#current-backend-info/mobile-hub-project.yml
awsmobile project's access information logged at:
    awsmobilejs/#current-backend-info/aws-exports.js
awsmobile project's access information copied to:
    src/aws-exports.js
contents in #current-backend-info/ is synchronized with the latest in the aws cloud
fs.js:1014
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EEXIST: file already exists, symlink '../mime/cli.js' -> '/Users/stevemao/workdir/news/awsmobilejs/backend/cloud-api/QueryPosts/node_modules/.bin/mime'
    at Object.fs.symlinkSync (fs.js:1014:18)
    at copySync (/Users/stevemao/.nvm/versions/node/v8.10.0/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8)
    at contents.forEach.content (/Users/stevemao/.nvm/versions/node/v8.10.0/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/Users/stevemao/.nvm/versions/node/v8.10.0/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/Users/stevemao/.nvm/versions/node/v8.10.0/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/Users/stevemao/.nvm/versions/node/v8.10.0/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/Users/stevemao/.nvm/versions/node/v8.10.0/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
codeyogi911 commented 6 years ago

Hi i am also facing the same issue:

contents in #current-backend-info/ is synchronized with the latest in the aws cloud
fs.js:1014
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EEXIST: file already exists, symlink '../uuid/bin/uuid' -> '/Users/shashwatjain/Projects/Ionic/myApp/awsmobilejs/backend/cloud-api/imageplumber/node_modules/.bin/uuid'
    at Object.fs.symlinkSync (fs.js:1014:18)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
stevekinney commented 6 years ago

Do y'all have anything custom going on in your Cloud APIs?

stevemao commented 6 years ago

@stevekinney no

dylan-westbury commented 6 years ago

Me too, node LTS and new aws amplify project.

New to awsmobile... what could be wrong?


    src/aws-exports.js
contents in #current-backend-info/ is synchronized with the latest in the aws cloud
fs.js:1014
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EEXIST: file already exists, symlink '../mime/cli.js' -> '/xxxx/wesbite/awsmobilejs/backend/cloud-api/sampleLambda/node_modules/.bin/mime'
    at Object.fs.symlinkSync (fs.js:1014:18)
    at copySync (/Users/Dylan/.nvm/versions/node/v8.11.2/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8)
    at contents.forEach.content (/Users/Dylan/.nvm/versions/node/v8.11.2/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/Users/Dylan/.nvm/versions/node/v8.11.2/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/Users/Dylan/.nvm/versions/node/v8.11.2/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/Users/Dylan/.nvm/versions/node/v8.11.2/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/Users/Dylan/.nvm/versions/node/v8.11.2/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)

website Dylan$ node -v
v8.11.2
ianpogi5 commented 6 years ago

Here's mine:

contents in #current-backend-info/ is synchronized with the latest in the aws cloud
fs.js:1014
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EEXIST: file already exists, symlink '../../../../../../../semver/bin/semver' -> '/xxxx/awsmobilejs/backend/cloud-api/jobs/node_modules/.bin/semver'
    at Object.fs.symlinkSync (fs.js:1014:18)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)

node v8.11.2 npm v5.6.0

ianpogi5 commented 6 years ago

Here's what I did to recreate the problem.

  1. Create the App in the Mobile Hub AWS console.
  2. Enable Cloud logic.
  3. Create new API.
  4. On your project source code, awsmobile init projectid
  5. awsmobile pull
  6. cd awsmobile/backend/cloud-api/your-api-folder/
  7. Create package.json file
  8. npm install aws-sdk --save
  9. Go back to root folder of your project
  10. awmobile push
jtnix commented 6 years ago

Same for me, nothing super custom going on, but I did manually change the remote AWS node version to 8.10 for all API routes in the mobile-hub-project.yml file just before it started happening:

contents in #current-backend-info/ is synchronized with the latest in the aws cloud
fs.js:143
    throw err;
    ^

Error: EEXIST: file already exists, symlink '../uuid/bin/uuid' -> '/Users/xxx/react/xxx/awsmobilejs/backend/cloud-api/xxx/node_modules/.bin/uuid'
    at Object.fs.symlinkSync (fs.js:1000:3)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)

When I remove the node_modules from the awsmobilejs/backend/cloud-api/xxx folder, and re-run awsmobile push I get a similar error, but from within a different 'package' this time:

Error: EEXIST: file already exists, symlink '../mime/cli.js' -> '/Users/xxx/react/xxx/awsmobilejs/backend/cloud-api/xxx/node_modules/.bin/mime'
    at Object.fs.symlinkSync (fs.js:1000:3)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)

The deployed serverless code still works for me in any case, it's just a confusing error!

realadeel commented 6 years ago

Getting something similar when running "awsmobile push". Last thing I did was npm install a new library ("getstream"). Uninstalling it and re-pushing did not fix the error.

node v9.2.0 npm v5.5.1

===== contents in #current-backend-info/ is synchronized with the latest in the aws cloud fs.js:1034 return binding.symlink(preprocessSymlinkDestination(target, type, path), ^

Error: EEXIST: file already exists, symlink '../sshpk/bin/sshpk-conv' -> '/Users/xxx/projects/xxx/awsmobilejs/backend/cloud-api/API/node_modules/.bin/sshpk-conv' at Object.fs.symlinkSync (fs.js:1034:18) at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8) at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7) at Array.forEach () at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14) at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7) at Array.forEach () at copySync (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14) at contents.forEach.content (/usr/local/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7) at Array.forEach ()

realadeel commented 6 years ago

This worked for me: remove node_modules npm install --no-bin-links

Inspiration: https://github.com/joyent/node-sshpk/issues/16

stevemao commented 6 years ago

This worked for me: remove node_modules npm install --no-bin-links

Yup, I googled it and saw that too... Seems like a workaround, not a fix.

jbarwick commented 6 years ago

My experience was that it fixed the immediate push. But, if you have pushed these symlinks before, the lambda function will fail with deception causing a cloud formation infinite loop and inability to update or fix the problem without deleting the entire stack and rebuild after manually deleting the #current-backend-Info and .awsmobile/build-info directories.

But even that might not work and you might need to delete the entire cloud formation stack and restart from scratch.

But then the mobile-hub-project.yml might be out of sync and and might be impossible to re-sync.

Good luck!

Sent from my iPhone

On 5 Jul 2018, at 8:16 AM, Steve Mao notifications@github.com wrote:

This worked for me: remove node_modules npm install --no-bin-links

Yup, I googled it and saw that too... Seems like a work around not a fix.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

stevemao commented 5 years ago

I want to emphasize that this issue is really critical... awsmobile publish is completely broken.

barrypeterson commented 5 years ago

Same issue: -- Lmk how I can help!

awsmobile project's access information copied to:
    app/aws-exports.js
contents in #current-backend-info/ is synchronized with the latest in the aws cloud
fs.js:1014
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EEXIST: file already exists, symlink '../mime/cli.js' -> '/Users/bpeterson/Projects/notify/awsmobilejs/backend/cloud-api/messages/node_modules/.bin/mime'
    at Object.fs.symlinkSync (fs.js:1014:18)
    at copySync (/Users/bpeterson/.nvm/versions/node/v8.11.3/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:8)
    at contents.forEach.content (/Users/bpeterson/.nvm/versions/node/v8.11.3/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/Users/bpeterson/.nvm/versions/node/v8.11.3/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/Users/bpeterson/.nvm/versions/node/v8.11.3/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (/Users/bpeterson/.nvm/versions/node/v8.11.3/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:14)
    at contents.forEach.content (/Users/bpeterson/.nvm/versions/node/v8.11.3/lib/node_modules/awsmobile-cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
nishanthk commented 5 years ago

Is there a fix for this, having same issue

idevelop commented 5 years ago

Still an issue in 2019 :)

nawwa commented 5 years ago

Yes still an issue .. awsmobile push give Error: EEXIST: file already exists, symlink '../json2csv/bin/json2csv.js' ->

:(

automatication commented 5 years ago

Removed node_modules and did: npm install --no-bin-links

Seems to work for me.

nawwa commented 5 years ago

@automatication same, worked today :)

shivaramani commented 5 years ago

Still getting the error. Any other workarounds? Not working with removing nodemodules and npm install --no-bin-links

Error: EEXIST: file already exists, symlink '../uuid/bin/uuid' -> '//node_modules/aws-sdk/node_modules/.bin/uuid'

at /node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:7