I create private npm registry
with verdaccio
.
I want to able to run npm install --registry="http://localhost:4873"
and get all dependencies from private registry
.
I need to publish all packages from my project node_modules
directory.
I had to run npm publish
in each package in node_module
directory.(I could't find any better way.)
more of them published successfully But in some case, I encountered with the error. for example in zone.js
package:
npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! zone.js@0.8.29
prepublish: `tsc && gulp build` npm ERR! Exit status 2 npm ERR! npm
ERR! Failed at the zone.js@0.8.29 prepublish script. npm ERR! This is
probably not a problem with npm. There is likely additional logging
output above. npm WARN Local package.json exists, but node_modules
missing, did you mean to install?
or in acorn
package:
acorn@5.7.3 build:main C:\Users\Admin\Desktop\test ng\ng-prj\node_modules\acorn
rollup -c rollup/config.main.js
'rollup' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! acorn@5.7.3 build:main: `rollup -c rollup/config.main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the acorn@5.7.3 build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
Is there a simple way of doing this?
here Verdaccio maintainer.
I want to able to run npm install --registry="http://localhost:4873" and get all dependencies from private registry.
What do you want is to have an offline registry with all your dependencies. Publish all node_modules
is not practical and almost impossible.
more of them published successfully But in some case, I encountered with the error. for example in zone.js
That's the point, you would need to build each dependency, it just does not make sense. A regular project can easily have thousands of dependencies and sub dependencies. Not to mention you would lose the adventage of future dependencies updates.
So, what you need is cache properly all dependencies in your storage folder.
$> verdaccio
npm install --registry="http://localhost:4873
proxy
from the config file as followspackages:
'@*/*':
access: $all
publish: $authenticated
# proxy: npmjs
'**':
access: $all
publish: $authenticated
# proxy: npmjs
If you comment out
proxy
Verdaccio won't ask for any update to the remotes, by default isnpmjs
, thus, no connection to external networks will be performed.
So, here, the advantages of this approach.
lodash: ^1.5.6
)node_modules
and clean the npm cache
as well.node_modules
, thus see point 2).I hope this helps you. Furthermore, there are other practices related with offline mode, but only with yarn.