When trying to install from the package.json, following error occurs
>npm install npm ERR! install Couldn't read dependencies npm ERR! Error: Invalid version: "1.0.0.0"
package.json
{
"name": "version-sample",
"version": "1.0.0.0",
"dependencies": {
"sample" : "*"
}
}
You need to make sure you have a package. json file right in the current directory where you run the command. Once you see there's a package. json file in the output as shown above, then you can run the npm install command.
You can downgrade the npm version by specifying a version in the related commands. If you want to downgrade npm to a specific version, you can use the following command: npm install -g npm@[version.
For npm install specific version, use npm install [package-name]@[version-number]. Use npm view [package-name] version to know the specific latest version of a package available on the npm registry. Use npm list [package-name] to know the specific latest version of an installed package.
Check npm's proxy configuration. Check that it's not a problem with a package you're trying to install (e.g. invalid package.json). Many ENOENT / ENOTEMPTY errors in output. npm is written to use resources efficiently on install, and part of this is that it tries to do as many things concurrently as is practical.
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.
npm install <alias>@npm:<name>: Install a package under a custom alias. Allows multiple versions of a same-name package side-by-side, more convenient import names for packages with otherwise long ones and using git forks replacements or forked npm packages as replacements.
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 ...
the version number can only be like \d+\.\d+\.\d+
so \d+\.\d+.\d+.\d+
is not valid. so "1.0.0.0" is not valid and and "1.0.0" is. But check the link below for a more accurat description.
This works:
package.json
{
"name": "version-sample",
"version": "1.0.0",
"dependencies": {
"sample" : "*"
}
}
The full documentation is located here https://semver.org/ (including a proper regex
"1.0" is not a valid version as defined by Semantic Versioning. Changing it to "1.0.0" should solve your issue.
npm_modules
folderpackage.json.lock
filenpm cache clean --force
And try installing again using npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With