Since updating bower to version 1.5.2, a get EINVALID error when bower is installing :
font-awesome : The "main" field cannot contain font, image, audio, or video files
select2 : The name has to end with a lower case character from a to z
bootstrap-datetimepicker : The "main" field cannot contain minified files
...
With previous version of bower (1.3.12), there was no error.
Is that possible to ignore this errors?
My bower.json file :
{
"name": "project",
"version": "1.0.0",
"dependencies": {
"jquery": "components/jquery#~2.1.1",
"js-cookie": "~2.0",
"bootswatch-scss": "~3",
"bootstrap-sass-official": "3.3.*",
"select2-bootstrap-css" : ">=1.4.6",
"tinymce": "4.2.*",
"bootstrap-table": "~1.8",
"bootstrap-datepicker": "~1.4",
"eonasdan-bootstrap-datetimepicker": "~4.15",
"moment": "~2.10",
"select2-bootstrap-theme": "0.1.0-beta.4",
"hinclude": "0.9.*"
}
}
Update
At this time, I regress to version 1.3.12
npm uninstall bower -g
npm install -g bower#1.3.12
Related
npm version: 7.24.2
someone know update a child dependency, I have the dependency:
vue-tel-input
and this dependency has the dependency libphonenumber-js with version: ^1.9.6
I want to update this libphonenumber-js to ^1.10.12
I already tried with:
https://docs.npmjs.com/cli/v8/configuring-npm/package-json?fbclid=IwAR2lAcPyu2XTTR5srKIEOpr1v8HM6UZL66WC42IG_8c3UU_u_vXeSPAL8J8#overrides
https://stackoverflow.com/a/48524488
any idea?
I don't think you can do that easily with your current setup.
you can either update to npm v8.3+, which supports overrides or use yarn with resolutions
more info:
overrides(npm):
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
package.json
"overrides": {
"vue-tel-input": {
"libphonenumber-js": "^1.10.12"
}
}
resolutions(yarn):
https://classic.yarnpkg.com/en/docs/selective-version-resolutions/
package.json
"resolutions": {
"libphonenumber-js": "^1.10.12"
}
alternatively, you can manage the package-lock.json file manually to define the version
"vue-tel-input": {
"version": "5.11.0",
"resolved": "https://registry.npmjs.org/vue-tel-input/-/vue-tel-input-5.11.0.tgz",
"integrity": "sha512-kw13LdbnSH+Zk5Qb06vflG7Abu6QsM1cQyKvTA9T4kaZeARvyvKo9YZmziy7WiSuar932DWRjGI0SJnban4a2A==",
"requires": {
"core-js": "^3.14.0",
"libphonenumber-js": "^1.9.6",
"vue": "^2.6.14"
}
},
you might be able to change "libphonenumber-js": "^1.9.6" to use ^1.10.12
but wanted to point out that when I did a fresh install, it did install 1.10.12
"node_modules/libphonenumber-js": {
"version": "1.10.12",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.12.tgz",
"integrity": "sha512-xTFBs3ipFQNmjCUkDj6ZzRJvs97IyazFHBKWtrQrLiYs0Zk0GANob1hkMRlQUQXbJrpQGwnI+/yU4oyD4ohvpw=="
},
Because ^ will update to the latest minor version (2nd number), it should use a specific version, so in this case, because you're going from 1.9.* to 1.10.* and using ^1.9.6 you may be able to just remove your lock file and re-install to get 1.10.12
I have a Node app that is tested on node 10. I am using yarn as a dependency manager. As my app test is run on CI with the latest version of node 10, I want to make sure that all developers have installed the latest 10.x.x version when running any yarn command.
For example, let's say the current latest node version is 10.22.1, then I want to stop the yarn install if the developer is on 10.22.0 or 10.11.1.
Using the engine directive in package.json I tried the following syntax but no avail.
{
"engines": {
"node": "^10.x.x",
}
}
{
"engines": {
"node": "^10",
}
}
{
"engines": {
"node": ">10.0.0 <11.0.0",
}
}
{
"engines": {
"node": "10",
}
}
All of these allow any node with major version 10.
As per the yarn documentation (https://classic.yarnpkg.com/en/docs/package-json/), the preinstall is called before the package is installed.
If defined, the preinstall script is called by yarn before your package is installed.
So I would go with something like this in your package.json:
"scripts": {
....
"preinstall": "./scripts/preinstall.sh",
}
Your preinstall.sh could be:
#!/bin/bash
currentver="$(node -v)"
requiredver="v10.0.0"
if [ "$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
echo "Version is good so let's go with install"
else
echo "Please install the node version greater than v10.0.0"
exit -1
fi
So if your developer has a version less than v10.0.0, the above script will fail and will in turn fail the yarn install command.
Note: Credit to https://unix.stackexchange.com/questions/285924/how-to-compare-a-programs-version-in-a-shell-script for shell script for version comparison.
As we have in the npm doc :
to specify acceptable version ranges up to 1.0.4, use the following syntax:
Patch releases: 1.0 or 1.0.x or ~1.0.4
Minor releases: 1 or 1.x or ^1.0.4
Major releases: * or x
So, if you want to ask for only the 10.22.1 version or newer you should use ~10.22.1 or ^10.22.1
And it's another option to pin the version (you can read more about it from this link) by using the exact version like:
{
"engines": {
"node": "10.22.1",
}
}
bowercopy is a deprecated tool for newer projects
Below task(from here) is the grunt task using bowercopy tool as dependency:
var JS_VENDOR_PATH = 'public/js/vendor',
CSS_VENDOR_PATH = 'public/css/vendor';
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-bowercopy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.initConfig({
clean: {
'vendor-js': JS_VENDOR_PATH,
'vendor-css': CSS_VENDOR_PATH
},
bowercopy: {
options: {
},
js: {
options: {
destPrefix: JS_VENDOR_PATH
},
files: {
'todomvc-common.js' : 'todomvc-common/base.js',
'jquery.js' : 'jquery/jquery.js',
'underscore.js' : 'underscore/underscore.js',
'backbone.js' : 'backbone/backbone.js'
}
},
css: {
options: {
destPrefix: CSS_VENDOR_PATH
},
files: {
'todomvc-common.css':'todomvc-common/base.css'
}
}
}
});
grunt.registerTask('default', ['clean','bowercopy']);
};
We get deprecation issues, as shown below:
$ npm install
npm WARN deprecated bower#1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated coffee-script#1.3.3: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
audited 197 packages in 2.475s
found 29 vulnerabilities (6 low, 6 moderate, 17 high)
run `npm audit fix` to fix them, or `npm audit` for details
Npm version is 6.11
How to remove bower & bowercopy dependency in this grunt task? And use webpack instead of grunt...
{
"name": "xxx",
"version": "1.0.0",
"scripts": {
"prepublish": "grunt",
"build": "grunt",
"start": "open index.html || sensible-browser index.html || xdg-open index.html"
},
"repository": {
"type": "git",
"url": "https://github.com/xxxx"
},
"bugs": {
"url": "https://github.com/xxxx/issues"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-bowercopy": "^1.2.4",
"grunt-contrib-clean": "^0.6.0"
},
"dependencies": {
"express": "^4.13.3"
}
}
The Problem
There are some problem with maybe my installation of better-sqlite3 because when I try to execute my index.js (click to show it on pastebin) with
node index.js
there is always the same result. I tried on MacOS, it works but in my machine Linux Lite Ubuntu based distro aren't it gave me the following same error:
/home/mp8/webproject/electron-better-sqlite/node_modules/bindings/bindings.js:96
throw err
^
Error: Could not locate the bindings file. Tried:
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/build/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/build/Release/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/Debug/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/out/Release/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/Release/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/build/default/better_sqlite3.node
→ /home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/compiled/8.11.3/linux/x64/better_sqlite3.node
at bindings (/home/mp8/webproject/electron-better-sqlite/node_modules/bindings/bindings.js:93:9)
at Object.<anonymous> (/home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/lib/database.js:4:40)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/mp8/webproject/electron-better-sqlite/node_modules/better-sqlite3/index.js:2:18)
What is my purpose?
I want to use better-sqlie33 as my database because sqlite3 doesn't gave the node 8.x and later support.
What I tried:
This trouble shooting guide number one and two, but I still had the same error.
make init, first installed better-sqlite3 gave me the error file make/makefile not found. I got the same error when I do npm install better-sqlite3 --save
Make sure better_sqlite3.node are on my node-modules path. yeah it isn't there.
What I want?
I want to run my index.js correctly like I ran it on Mac.
Dependecies
package.json after make init, if not it just a better-sqlite3 dependencies
{
"_from": "better-sqlite3",
"_id": "better-sqlite3#4.1.4",
"_inBundle": false,
"_integrity": "sha512-Y11HN9PQ9YUeKFMrmiHyOLAKElk2ATJzBZJvuzNwTMxoS7vUEEyLnUCtcBFqViLwbomr0RQwp2MBy/ogxF50PA==",
"_location": "/better-sqlite3",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "better-sqlite3",
"name": "better-sqlite3",
"escapedName": "better-sqlite3",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-4.1.4.tgz",
"_shasum": "9fe1dcf7b699087b98b1997cbb00261e265897e2",
"_spec": "better-sqlite3",
"_where": "/home/mp8/webproject/electron-better-sqlite",
"author": {
"name": "Joshua Wise",
"email": "joshuathomaswise#gmail.com"
},
"bugs": {
"url": "https://github.com/JoshuaWise/better-sqlite3/issues"
},
"bundleDependencies": false,
"dependencies": {
"bindings": "^1.3.0",
"integer": "^1.0.5"
},
"deprecated": false,
"description": "The fastest and simplest library for SQLite3 in Node.js.",
"devDependencies": {
"benchmark": "^2.1.4",
"chai": "^4.1.2",
"cli-color": "^1.2.0",
"fs-extra": "^5.0.0",
"mocha": "^4.1.0",
"sqlite": "^2.9.0"
},
"gypfile": true,
"homepage": "http://github.com/JoshuaWise/better-sqlite3",
"keywords": [
"sql",
"sqlite",
"sqlite3",
"custom",
"aggregate",
"database",
"transactions"
],
"license": "MIT",
"name": "better-sqlite3",
"repository": {
"type": "git",
"url": "git://github.com/JoshuaWise/better-sqlite3.git"
},
"scripts": {
"benchmark": "node benchmark",
"install": "node-gyp rebuild",
"install-debug": "node-gyp rebuild --debug",
"lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz",
"posttest": "rm -r ./temp/",
"prepublishOnly": "npm run lzz",
"pretest": "rm -r ./temp/ || true && mkdir ./temp/",
"rebuild": "npm run lzz && node-gyp rebuild",
"rebuild-debug": "npm run lzz && node-gyp rebuild --debug",
"test": "$(npm bin)/mocha --bail --timeout 5000 --slow 5000"
},
"version": "4.1.4"
}
my machine
Linux Lite 4.0, Ubuntu Based.
NVM (Node version Manager)
Node 8.11.1
NPM 5.6
I had a problem that looks like your problem
just try that:
projectToto > $ sudo rm -rf node_modules/
projectToto > $ npm install bindings
npm about binding -> https://www.npmjs.com/package/bindings
I ran into a similar situation until I realized I hadn't explicitly installed build-tools on that machine. Here's what resolved it for me (Ubuntu) when run from inside the project directory
$ rm -rf node_modules/
$ rm package-lock.json
$ npm install build-tools -g
$ npm install
For me, the problem turned out to be a circular dependency in my project (angular 10.1.1, node 12.22.6).
Figuring that out was a little tricky. The Angular compiler gave multiple "WARNING in Circular dependency detected: ..." errors, but none of them included the files where the error was actually introduced. I had to walk the project back until a commit where the problem didn't occur, then investigate what changed. That change seemed pretty innocuous - one file exported a constant that was imported by another. Changing the direction of that export solved the problem.
If nothing works....
create a new folder :
install a fresh copy with npm, which will create node_module folder with all the required files.
copy node_module folder and replace with the existing project node_module folder.
close cmd
restart server.
And it worked for me....
My bower.json:
{
"...." : "...."
"name": "myproject",
"dependencies": {
"angular": "1.2.20",
"bootstrap": "latest"
}
}
I'd like to replace "latest" in bootstrap dependency by its actual version number. Is there any way to do that via bower command ? (not via a custom script)
No, bower doesn't have shrinkwrap feature.
It is a long-standing issue: https://github.com/bower/bower/issues/505