serlingpa
serlingpa

Reputation: 12710

./node_modules/.bin/webpack-dev-server not found

I have a seed project from which I have deleted the node_modules just for the sake of completeness before committing to source control (yes, I have a .gitignore).

Having then subsequently run npm install, I have discovered that there is no .\node_modules\.bin folder from which to launch the webpack dev server. This has previously worked fine. I have "webpack-dev-server": "^1.14.1" in my devDependencies.

Anyone know why my .bin folder is not being created by npm?

Hmm.

Upvotes: 3

Views: 5392

Answers (1)

bitten
bitten

Reputation: 2543

Do you have a .\node_modules\webpack-dev-server\ folder also? If not, then you know it's failing to install completely rather than just installing the bin file.

npm install should install every dependency in your package.json file, so something is up.

npm install (in package directory, no arguments):

Install the dependencies in the local node_modules folder.

In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.

By default, npm install will install all modules listed as dependencies in package.json.

With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.

Firstly

I would first make sure that your npm config is not set to production. Run this command:

npm config get production

..and if it it returns true, then set it to false with:

npm config set production false

Secondly

If this fails, then create a new folder in a completely different location (even under a different hard drive or username) and set up your package.json file all over again (npm init, npm install module, npm install module2 --save-dev, and so on..). If this works, then perhaps npm is scaling your directory looking for certain dependencies, finding one somewhere, and therefore not installing it here.

Thirdly

Check your npmrc file. Run npm config list and make sure everything looks okay here (it's a long shot, however, something may be up).

Or..

If you do not want to do that, then it's possible to force an install of only the devDependencies with this command

npm install --only=dev

Good luck!

Upvotes: 2

Related Questions