Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm package from github, missing files

I'm trying to reference logary-js (DISCLAIMER: my own project) from a project of mine.

I have this packages.json file:

...
"dependencies": {
  "logary": "logary/logary-js#master",
  ...
}
...

However, when trying to pull down the package, it fails with this error:

✗ npm install

> [email protected] preinstall /Users/h/dev/proj/node_modules/.staging/logary-6603d70a
> npm run build


> [email protected] build /Users/h/dev/proj/node_modules/.staging/logary-6603d70a
> NODE_ENV=production webpack --progress --color --display-error-details --display-reasons --optimize-minimize

webpack 1.12.14
Usage: https://webpack.github.io/docs/cli.html

Options:
  --help, -h, -?
  --config
  --context
  --entry
  --module-bind
  --module-bind-post
  --module-bind-pre
  --output-path
  --output-file
  --output-chunk-file
  --output-named-chunk-file
  --output-source-map-file
  --output-public-path
  --output-jsonp-function
  --output-pathinfo
  --output-library
  --output-library-target
  --records-input-path
  --records-output-path
  --records-path
  --define
  --target
  --cache                                                                                           [default: true]
  --watch, -w
  --watch which closes when stdin ends
  --watch-aggregate-timeout
  --watch-poll
  --hot
  --debug
  --devtool
  --progress
  --resolve-alias
  --resolve-loader-alias
  --optimize-max-chunks
  --optimize-min-chunk-size
  --optimize-minimize
  --optimize-occurence-order
  --optimize-dedupe
  --prefetch
  --provide
  --labeled-modules
  --plugin
  --bail
  --profile
  -d                                    shortcut for --debug --devtool sourcemap --output-pathinfo
  -p                                    shortcut for --optimize-minimize
  --json, -j
  --colors, -c
  --sort-modules-by
  --sort-chunks-by
  --sort-assets-by
  --hide-modules
  --display-exclude
  --display-modules
  --display-chunks
  --display-error-details
  --display-origins
  --display-cached
  --display-cached-assets
  --display-reasons, --verbose, -v

Output filename not configured.

npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/h/.nvm/versions/node/v5.6.0/bin/node" "/Users/h/.nvm/versions/node/v5.6.0/bin/npm" "run" "build"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `NODE_ENV=production webpack --progress --color --display-error-details --display-reasons --optimize-minimize`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] build script 'NODE_ENV=production webpack --progress --color --display-error-details --display-reasons --optimize-minimize'.

Which is an error you get if there's no webpack.config.js file in the directory. This makes me believe that npm is only pulling down a few files. npm-debug.log says:

89 verbose tar unpack /Users/h/.npm/logary/1.0.0/package.tgz
90 verbose tar unpacking to /Users/h/dev/proj/node_modules/.staging/logary-6603d70a
91 silly gentlyRm /Users/h/dev/proj/node_modules/.staging/logary-6603d70a is being purged
92 verbose gentlyRm don't care about contents; nuking /Users/h/dev/proj/node_modules/.staging/logary
-6603d70a
93 silly gunzTarPerm modes [ '770', '660' ]
94 silly gunzTarPerm extractEntry package.json
95 silly gunzTarPerm extractEntry README.md
96 silly gunzTarPerm extractEntry LICENSE
97 silly gentlyRm /Users/h/dev/proj/node_modules/.staging/logary-6603d70a/node_modules is being purg
ed
98 verbose gentlyRm don't care about contents; nuking /Users/h/dev/proj/node_modules/.staging/logary
-6603d70a/node_modules
99 silly doParallel preinstall 1
100 silly preinstall [email protected] /Users/h/dev/proj/node_modules/.staging/logary-6603d70a
101 info lifecycle [email protected]~preinstall: [email protected]

Also, in this example https://github.com/logary/logary-js/tree/master/examples/webpack it's referencing logary just fine, albeit through the file system rather than github.

So the question becomes; how do I reference logary from github? Or what should I change in its package.json file to make it work?

like image 628
Henrik Avatar asked Apr 06 '16 20:04

Henrik


1 Answers

You can install a Node package from GitHub using the syntax npm install --save https://github.com/{USER}/{REPO}/tarball/{BRANCH}. You could also check this answer, it has great tips about this.

like image 98
Miguel Asencio Avatar answered Oct 25 '22 23:10

Miguel Asencio