1

I've run into an issue with running npm install. It's not finding the postinstall script and builds the path to the script duplicating the path, removing the slashes on the second half (eg: C:\User\Me\Repo\UserMeRepoScript.js). The script file does exist.

Image of problem

I have tried deleting and node-modules and package-lock. I've also tried uninstalling node.js, running npm cache clean --force then restarting, I've also made sure %appdata%\npm and %appdata%\npm-cache are deleted but still getting the same issue.

node version is 14.17.0 which is needed to run the project. with npm version 6.14.13 8.5.5


Update 22/3

The issue remains but I can get NPM to run and install in powershell. I'm now facing a new issue where the conmmand twilio flex:plugins:build is erroring out with seeming the same issue surrounding missing slashes. Unfortunately this time it's also showing the same issue in powershell.

new issue

ThatDeltaGuy
  • 11
  • 1
  • 3
  • That is really odd. It seems like that would be caused by `npm` (though no idea why), have you tried updating `npm` to the latest? (`npm install npm@latest -g`) – philnash Mar 20 '22 at 23:12
  • npm is now at 8.5.5 but still have the same issue – ThatDeltaGuy Mar 21 '22 at 11:18
  • It's just so weird that `npm` would try to run the script like that, particularly doubling the path, but stripping slashes from it. – philnash Mar 21 '22 at 21:57

2 Answers2

0

I think that the error you are getting now isn't to do with removing slashes. While there are no slashes in the file paths in the output, I think that is a display thing rather than an issue in the actual running of the program.

Instead, what the new error message is saying is that you are missing a dependency (@babel/plugin-proposal-private-property-in-object to be precise). This module is down the dependency tree of @twilio/flex-plugin-scripts, so perhaps hasn't installed correctly. I would recommend that you remove your node_modules directory and perform npm install again, to give you a clean install of dependencies. Then try building the plugin again.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • unfortunately not a fix, the same issue is still occuring. I'm also still having the original issue of NPM not working in bash, just powershell, so i'm still thinking its an issue with npm itself. However re-installing npm hasnt worked. Should also add that the @babel does seem to be installed properly. – ThatDeltaGuy Mar 24 '22 at 10:11
  • I’m not sure then. I’m on a Mac and I’ve not seen that happen before. It looks like an npm problem to me, perhaps try reporting it on the npm repo? – philnash Mar 24 '22 at 12:53
0

I had a similar error that led me to this post (keyword 'postinstall'), so I thought I share my work around. But to explain, my error has something to do with nodejs and wsl not syncing, thus creating some dependency errors during builds as they are in different environments. You could fix this, by (but honestly I think it's a big hassle, you should just wait for their official release - if there's any):

To save myself from potentially balding, you could try docker. Or if docker is not your style, you can use a popular node version manager called NVM. Uninstall your windows node, and move things to your WSL instead.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33006914) – L8R Oct 27 '22 at 17:32