How to manage a non-node module as dependency for Node Project thorugh NPM? - npm

I was using bower in my project for dependency management. But now I wanted to move to node and npm. But the problem is few of my dependencies are not node modules like Smooth-Div-Scroll1 and swiftype-search-jquery2
How to manage all those dependencies in my node project. When I tried doing
"swiftype-search-jquery": "git#github.com:swiftype/swiftype-search-jquery.git",
"smooth-div-scroll": "git#github.com:tkahn/Smooth-Div-Scroll.git",
it is not able to download dependency and throw error
npm ERR! code ENOPACKAGEJSON npm ERR! package.json Non-registry package missing package.json: swiftype-search-jquery#git+ssh://git#github.com/swiftype/swiftype-search-jquery.git. npm ERR! package.json npm can't find a package.json file in your current directory.
These dependencies don't have package.json in their folder.

I don't think it's possible.
Here is a guide to migrate from bower to npm, it's pretty easy.
https://codecraft.tv/courses/angularjs-migration/step-2-typescript-and-webpack/converting-bower-to-npm/

Yup, It is not possible with NPM but at the same time, it is possible with Yarn without making any change. Instead of "npm install" we have to use "yarn install" .
Add dependencies with git url which is not present with NPM .

Related

I cannot npm install with just created vue2 + vuetify proj

installed latest vue/cli and created project using vue2.
After this, I added vuetify and thats all for additional to basic vue2 template list of packages.
When I have tryed to use 'npm install'
Found: #vue/cli-service#undefined
npm ERR! node_modules/#vue/cli-service
npm ERR! dev #vue/cli-service#"5.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #vue/cli-service#"^3.0.0 || ^4.0.0 || ^5.0.0-0" from #vue/cli-plugin-babel#5.0.0
npm ERR! node_modules/#vue/cli-plugin-babel
npm ERR! dev #vue/cli-plugin-babel#"5.0.0" from the root project`
can you guys explain me meaning of error
myVersions
As you are seemingly on an old version of npm (<=6.x) you need to install the peer dependency yourself:
npm i -D #vue/cli-service#5.0.0
After installing the dependency, edit your package.json and insert this block on the top level, right after the "devDependencies" object:
"peerDependencies": {
"#vue/cli-service": "^5.0.0"
}
and remove that dependency from the "devDependencies" object.
If you don't want to deal with peer dependencies yourself, upgrade your node and npm version. To upgrade npm only:
npm i -g npm
Despite the fact that I reconfigured entire project. I will anyway answer this question.
Issue was related to cli-service 5.0.0, when I should have had 5.0.8 in order to use babel 5.0.0.
I want to add that if you use default vue.2 template with vue/cli 5.0.8,
You will get another error after installing vuetify, which was not able to fix.
Error is related to vuetify loader.
I fixed it with start up new project and manually inserting all dependencies compatible with vuetify-loader 1.5
Because 1.7 brakes npm run serve

Error while moving bower to npm in ember project

I was trying to move all the bower packages as npm packages as part of our ember upgrade process.
Updated cli from 3.0.0 to 3.22 successfully.
While trying to move sweetalert2 from bower to npm using the below steps.
bower uninstall sweetalert2 --save //remove the package and remove from bower.json also
npm install sweetalert2 --save-dev //add as npm package and add in package.json also
ember s
While building project it throws the following error.
Build Error (SourceMapConcat)
ENOENT: no such file or directory, open '/var/folders/wm/w121z2bs7yngf13gc_qbsn_w0000gn/T/broccoli-5259Sy2X7u6LvqKk/out-854-broccoli_debug_debug_5_vendor_js/bower_components/sweetalert2/dist/sweetalert2.js'
Can anyone help me with this?

How to add npm module without changing old dependencies in package-lock.json?

I use npm ci to install npm modules and it install same package versions as in package-lock.json
And now I need to add npm module for starting write unit tests, I use this command: npm i jest
I expect that it should add only jest dependencies, but npm update all out-of-date dependencies of 3-5 level dependencies in package-lock.json
I would like to do something like this npm ci --save-dev jest
How to install npm package without changing old dependencies in package-lock.json?
UPD For example, please clone this repo, after that use npm ci and npm i empty-module, if you look at git diff you'll see a lot of changes of package-lock.json file

npm install to just update dependency

I guess this sounds silly but is there a way to do npm install my-module such that it only updates the dependencies section of package.json but doesn't actually go through the install process?

How to install bower dependencies using npm install?

I want npm install to install the bower dependencies as well. I have a bower.json file containing frontend packages and there is package.json file which contains the backend packages. After i run npm install, node_modules are installed whereas the dependencies mentioned in bower.json file are not installed.
I don't want to use bower install rather I want to do all this with npm install command.
It's quite simple. If you have bower listed in package.json as dependency you may add postinstall script to your package.json as follows:
"scripts": {
"postinstall": "bower install"
}
and running npm install will launch also bower install automatically