Cli: [QUESTION] npm install puts bin files into invalid location

Created on 15 May 2020  路  5Comments  路  Source: npm/cli

What / Why

Hello, I am having a problem with npm install command. When I run it packages are installed normally but the "bin" folder is not created inside of "node_modules" folder. Instead all bin files are created in the project root (where package.json file is located and where I run the command).
I've already spent hours googling and didn't find anything.
Could you assist?

Where

  • n/a

Who

  • n/a

References

  • n/a
Question

Most helpful comment

So, what I have found out is that .npmrc is randomly created in the SystemProfile folder of Windows. It contains the following:

prefix=

After I remove this file everything works fine for a day or two and then the file is created again.

All 5 comments

Have you set any npm config properties like prefix? Check ~/.npmrc as well as your project directory for .npmrc files, and check env to see if there's anything with any capitalization with "prefix" in it.

@ljharb I've looked into it and have found .npm.rc in a weird location: C:\Users\<my_name>. It contained prefix= (empty prefix). I have removed this file and now binary files are places into correct folder.
What is weird: this .npm.rc file was not in C:\Users\<my_name>\App_Data\Roaming as I expected. And I definitely didn't create it. How could this happen?

(.npmrc, i assume, and not .npm.rc). If you ran npm config set prefix, for example, that might have created the file? (or some similar command)

Yes, sorry, of course its .npmrc. And no, I haven't run npm config. Actually I am using that computer for my Teamcity builds. Everything worked fine and then one day the builds just started to fail because of incorrect prefix as we have found out just now. Not sure how .npmrc could appear in that folder.

So, what I have found out is that .npmrc is randomly created in the SystemProfile folder of Windows. It contains the following:

prefix=

After I remove this file everything works fine for a day or two and then the file is created again.

Was this page helpful?
0 / 5 - 0 ratings