I created a vuejs2 project (using webpack) with 2 components, I want to publish this project on npm as a package so that I can use all the components inside this project with multiple projects (reusable components).
I published the project on npm npm publish
and installed the package using npm install my-components
, I found the project inside node_modules
but it was with the whole source code, as if I copy/pasted the project there.
Also when I try to run npm build dist
I am getting an error:
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! missing script: dist
npm ERR! npm ERR! If you need help, you may report this error at: npm ERR!
https://github.com/npm/npm/issuesnpm ERR! Please include the following file with any support request: npm ERR!
/Users/myuser/Documents/Projects/my-components/npm-debug.log
Inside my project ( https://github.com/Trelllis/my-components ), there is a component called vue-version which I can't use and the project my-components isn't resolved.
How can I publish this project properly with all its components?
Thanks
That's normal to have the full code if you included it the npm module. If you want a folder to be removed from npm, you can create a .npmignore
at the root of your project, with the same syntax as .gitignore
files. Find documentation for npmignore here .
For your second problem, you probably want to run npm run build
, which execute this file . At least I see nothing that could lead in your project to a valid use of npm build dist
(there is no dist folder). See general documentation for npm scripts , and documentation for npm build .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.