manelferreira / serverless-sequelize-migrations

A Serverless plugin to manage sequelize migrations
MIT License
21 stars 17 forks source link

Remove node modules folder from CLI path #8

Closed josephnle closed 2 months ago

josephnle commented 4 years ago

I use Yarn workspaces in my project and having the node_modules/.bin folder explicitly defined in the exec path causes the plugin to error. Removing it allows the plugin to use the bin local to the project, regardless of where it might be located.

In my specific case, I have a workspace defined with serverless-sequelize-migrations as a dependency. The bin gets installed 1 level up at the workspace root. Thus, it results in the following error:

/bin/sh: node_modules/.bin/sequelize: No such file or directory
Serverless: Error trying to create migration: 
Error: Command failed: node_modules/.bin/sequelize migration:create --name initialize
/bin/sh: node_modules/.bin/sequelize: No such file or directory
manelferreira commented 4 years ago

Hi @josephnle ,

Thanks for the warning and sorry for my delay in responding.

I noticed that there are more problems related to this line of code. I'll take a deeper look over the weekend.

manelferreira commented 4 years ago

Hello Joseph, how are you? Hope everything is great!

I'm sorry for the long delay. I sent you an email last Saturday, but I'll copy the content here too.

Anyway, last Saturday I tried to reproduce the error but I was not able to do so. Also, the change you've proposed breaks the plugin in another cases.

I noticed that when I install the plugin on a project I have, a node_modules folder is created inside the plugin folder, so I'm able to execute the create command with no problems.

Screenshot from 2020-05-16 12-23-35

You are using yarn workspaces, so the problem probably resides in some particularity within that use.

If it is possible, can you provide me some project or guideline so that I can reproduce the error?

Best Regards