andy4222 Posted January 30, 2022 Share Posted January 30, 2022 Hi, I am importing node modules within my workflow (written in node.js) and the workflow was working fine. However, I noticed that I had a node_modules directory in my home directory (~/) so I accidentally deleted. Then I ran the workflow and it of course failed. So I installed the package again using `npm install -g lodash` (instead of npm install lodash), the workflow is still not able to find node modules. I checked that the node module is now installed in global space (/usr/local/lib/node_modules/) and it listed when I do `npm list -g --depth=0`. Why is Alfred not finding it? Is it always looking in my home directory? How can I tell it to look in /usr/local/lib/node_modules/ My PATH has: export="/usr/local/lib:$PATH" export="/usr/local/lib/node_modules:$PATH" Link to comment
vitor Posted January 31, 2022 Share Posted January 31, 2022 1 hour ago, andy4222 said: My PATH has: export="/usr/local/lib:$PATH" export="/usr/local/lib/node_modules:$PATH" This is incorrect on several levels. You’re making a variable called export, which doesn’t alter PATH. Even if the code were correct (export PATH), adding those directories doesn’t make sense. PATH is about executables, not libraries. We can’t comment on what your Workflow needs without seeing it. In general, you should package its dependencies within it, not install them globally. Perhaps Understanding the scripting environment will give you a clue to understand how things work. Your current mental model seems confused. Link to comment
andy4222 Posted January 31, 2022 Author Share Posted January 31, 2022 (edited) My bad on pasting the wrong export path. They were correct in my bash profile. The link you shared about scripting env helped me. Now, I am including the node_modules in the workflow and it work fine across machines. Thanks for the help!! Edited January 31, 2022 by andy4222 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now