blaze-rowland
blaze-rowland

Reputation: 117

npm install not working in laravel 5.6

On a fresh install of laravel 5.6 via composer

How I installed it:

composer create-project laravel/laravel

After installing I ran:

npm install

I get back:

npm notice created a lockfile as package-lock.json. You should commit this file. Up to date in 0.163s.

It does not create a node_modules folder.

If I try using yarn to install the dependencies using:

yarn install

I get back:

yarn install v1.3.2 info No lockfile found. Resolving packages... warning laravel-mix > img-loader > imagemin-mozjpeg > mozjpeg > bin-wrapper > download > gulp-decompress > [email protected]: gulp-util is deprecated - replace it, following the guidlines at https://medium.com/gulpjs/gulp-util-ca3b1f9fac5 | Fetching packages... info [email protected]: The platform 'win32' is incompatible with this module. info "[email protected]" is an optional dependency and failed compatability check. Excluding it from installation. Linking dependencies.... Building fresh packages... success Saved lockfile. Done in 35.38s

This creates a node_modules folder with only ".yarn-integrity' no modules.

The link to the medium page doesn't work, receive 404 so no luck there.

My node version is: "v8.9.4" and my yarn version is: 'v1.3.2'

Upvotes: 0

Views: 14766

Answers (4)

Abdi
Abdi

Reputation: 608

this because you are not in laravel root folder, when you create a project, at first you are not in folder you need to open your project folder and use

npm i

Upvotes: 0

GreenLeaf
GreenLeaf

Reputation: 11

Just make sure you are in your project directory e.g

1) cd path/to/my_laravel_project
2) npm install

Upvotes: 0

blaze-rowland
blaze-rowland

Reputation: 117

running:

npm install --dev or npm install --only=dev

This installed the dependencies I needed. For whatever reason in laravel 5.6 all the dependencies are considered devDependencies in the package.json file.

Upvotes: 2

Prince Lionel N'zi
Prince Lionel N'zi

Reputation: 2588

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.

Run the following command

  1. git add -A
  2. git commit -m "Commit package-lock.json"
  3. git push -u origin master

Now re-run npm install

Upvotes: 0

Related Questions