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 > gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidlines at https://medium.com/gulpjs/gulp-util-ca3b1f9fac5 | Fetching packages... info fsevents#1.1.3: The platform 'win32' is incompatible with this module. info "fsevents#1.1.3" 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'
Edit: This isn't a git issue. I'm not using git
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.
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
git add -A
git commit -m "Commit package-lock.json"
git push -u origin master
Now re-run npm install
Just make sure you are in your project directory e.g
1) cd path/to/my_laravel_project
2) npm install
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
Related
I am trying to do local development of an NPM package and test it in a package which depends on it. I'm using NPM (7.5.3) and specifically npm link for this but running into a problem with the chain of dependencies.
The child package has dependencies, these are all added to the parent's node_modules folder when using npm install "git+https://github.com/name/child_package". But when I npm link that module:
cd child_package
npm link
cd ../parent_package
npm link child_package
With the last command run (npm link child_package), all of the dependencies for child_package which were in the node_modules of parent_package are removed. NPM reporting:
removed 60 packages, changed 1 package, and audited 231 packages in 1s
At which point all the compilation in the parent package fails due to the missing deps. It finds the child_package, which is symlinked as expected, but dependency defined in child_package of "gsap" has now been removed.
If I reinstall it using npm install "git+https://github.com/name/child_package" it will add the deps back into the node_modules folder of the parent project.
try to do the following:
cd child_package
npm install
that will install child dependencies to directory of child package
personally I hate npm link and always use npm publish (use version number like 1.0.0-preview.1 for your child package and remove '-preview.Number' when you are done)
This is a behavior introduced in npm V7 + .
The only reasonable "workaround" i have found is to go back to npm 6 (npm install -g npm#6).
Another "workaround" is to npm install --no-save ../../my-local-module but to reflect changes to the local module you will need to delete it from node_modules and reinstall again. Kind of lame....
I have an own npm package called mypackage, which is installed in over 50 repositories. I recently updated mypackage from version 1.1.0 to 1.2.0. In the package.json file in all repositories is the line: mypackage: "^1.0.12"
When I clone the repository, everything works fine and 1.2.0 gets installed.
When I run npm install in an existing local repository, where version 1.1.0 is installed, it remains at that version, even if I delete the package-lock.json and the node_modules folder before running npm install. I tried npm cache clear --force too, but same issue.
What am I doing wrong? I really don't want to update one line in 50+ package.json files.
Thank you in advance, Simon
Keep failing to install mobius-client-js"
C:\WINDOWS\system32>yarn add #mobius-network/mobius-client-js
yarn add v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
error #mobius-network/mobius-client-js#0.5.0: The engine "node" is incompatible with this module. Expected version ">=4 <=9". Got "10.14.1"
error Found incompatible module
Per Yarn's docs, you can use the following methods to add:
You can also specify packages from different locations:
yarn add package-name installs the package from the npm registry
unless you have specified another one in your package.json.
yarn add file:/path/to/local/folder installs a package that is on
your local file system. This is useful to test out other packages of
yours that haven’t been published to the registry.
yarn add file:/path/to/local/tarball.tgz installs a package from a
gzipped tarball which could be used to share a package before
publishing it.
yarn add <git remote url> installs a package from a remote git
repository.
yarn add <git remote url>#<branch/commit/tag> installs a package from
a remote git repository at specific git branch, git commit or git tag.
yarn add https://my-project.org/package.tgz installs a package from a
remote gzipped tarball.
None are working... any help would be amazing.
As per your error message:
The engine "node" is incompatible with this module. Expected version ">=4 <=9". Got "10.14.1"
It looks like you are running NodeJS 10.14.1, but the mobius-client requires a NodeJS version between 4 and 9. You should either check if there's a compatible version of this library or use something like nvm to switch to a previous version of node.
I work on a new project, but I can't install packages correctly. I used npm install, yarn, npm install --only=dev, but there aren't enough. I also try like that deleting node_modules and package-lock.json. The state was the same.
We use in the project babel's 6.x version. Babel has a update, 7.x, I think I get the error because of version differences when I run npm install, npm install --only=dev, yarn.
npm WARN deprecated babel-preset-es2015#6.24.1: � Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN babel-loader#8.0.4 requires a peer of #babel/core#^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN babel-loader#8.0.4 requires a peer of webpack#>=2 but none is installed. You must install peer dependencies yourself.
I use WebStorm. Before that, I tried to get package for another project with npm install. "Npm" is not successful. WebStorm advice me using Yarn, and I used Yarn. It was worked.
What should I do in the state?
After npm install, when I run parcel index.html, I get the console error
"Uncaught TypeError: window.fooes is not a constructor", Uncaught ReferenceError: regeneratorRuntime is not defined.
I know that the code doesn't have a problem, because project work on the team's computer correctly.
The first and most important:
Never use npm and yarn at the same time. Choose one of them and use that only because they are both using lock files based on the installed packages.
Which one to use:
npm and yarn are both using the NPM software registry database. So in the end the final result when installing packages are the same, but yarn does the job much-much faster. Yarn was developed by Facebook because the slowness of npm. So I prefer yarn, I'm not using npm commands anymore.
To your problem:
Delete the package-lock.json and yarn.lock lock files in your project root directory.
Also delete the whole node_modules directory.
Now you have only your package.json file. Make a backup of this file!
Open the original package.json and I suggest you to first delete all entries from it
related to Babel and save it.
Now run the yarn command (without params) in the project root (where your package.json file is). This should install all your packages again.
Then install the latest packages of Babel using these commands:
yarn add -D #babel/core
yarn add -D #babel/preset-env
yarn add -D babel-loader
You may need other packages from Babel. Have a look on your backed up package.json and search for the latest versions in the npm registry or Babel's plugins documentation page for the remaining plugins (if any).
There are quite a few modules which are listed on node's github page but are not published with the npm-registry. These modules can't be installed using npm.
What is the correct way to install these nodejs modules after cloning them from Git?
You need to download their source from the github. Find the main file and then include it in your main file.
An example of this can be found here > How to manually install a node.js module?
Usually you need to find the source and go through the package.json file. There you can find which is the main file. So that you can include that in your application.
To include example.js in your app. Copy it in your application folder and append this on the top of your main js file.
var moduleName = require("path/to/example.js")
These modules can't be installed using npm.
Actually you can install a module by specifying instead of a name a local path. As long as the repository has a valid package.json file it should work.
Type npm -l and a pretty help will appear like so :
CLI:
...
install npm install <tarball file>
npm install <tarball url>
npm install <folder>
npm install <pkg>
npm install <pkg>#<tag>
npm install <pkg>#<version>
npm install <pkg>#<version range>
Can specify one or more: npm install ./foo.tgz bar#stable /some/folder
If no argument is supplied and ./npm-shrinkwrap.json is
present, installs dependencies specified in the shrinkwrap.
Otherwise, installs dependencies from ./package.json.
What caught my eyes was: npm install <folder>
In my case I had trouble with mrt module so I did this (in a temporary directory)
Clone the repo
git clone https://github.com/oortcloud/meteorite.git
And I install it globally with:
npm install -g ./meteorite
Tip:
One can also install in the same manner the repo to a local npm project with:
npm install ../meteorite
And also one can create a link to the repo, in case a patch in development is needed:
npm link ../meteorite
Edit:
Nowadays npm supports also github and git repositories (see https://docs.npmjs.com/cli/v6/commands/npm-install), as a shorthand you can run :
npm i github.com:some-user/some-repo
Download the code from github into the node_modules directory
var moduleName = require("<name of directory>")
that should do it.
if the module has dependancies and has a package.json, open the module and enter npm install.
Hope this helps
You can clone the module directly in to your local project.
Start terminal. cd in to your project and then:
npm install https://github.com/repo/npm_module.git --save
Step-by-step:
let's say you are working on a project use-gulp which
uses(requires) node_modules like gulp and gulp-util.
Now you want to make some modifications to gulp-util lib and test it locally with your use-gulp project...
Fork gulp-util project on github\bitbucket etc.
Switch to your project: cd use-gulp/node_modules
Clone gulp-util as gulp-util-dev : git clone https://.../gulp-util.git gulp-util-dev
Run npm install to ensure dependencies of gulp-util-dev are available.
Now you have a mirror of gulp-util as gulp-util-dev. In your use-gulp project, you can now replace: require('gulp-util')...; call with : require('gulp-util-dev') to test your changes you made to gulp-util-dev