npm package from github, missing files - javascript

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
> logary#1.0.0 preinstall /Users/h/dev/proj/node_modules/.staging/logary-6603d70a
> npm run build
> logary#1.0.0 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! logary#1.0.0 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 logary#1.0.0 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 logary#1.0.0 /Users/h/dev/proj/node_modules/.staging/logary-6603d70a
101 info lifecycle logary#1.0.0~preinstall: logary#1.0.0
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?

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.

Related

ELIFECYCLE errorno 1 when deploying to production

I'm stucked with this problem and I need to fix it already so any tips will be truly appreciated.
I've my project made with Laravel and Vue, with an image container in Docker. The app is hosted in AWS.
The problem I'm facing is that I can't deploy the app to production using the follow command: ssh ec2-user#13.58.231.51 'cd /var/www/mevym/; ./deploy.sh'
The curious part is that if I run npm run production it works perfectly fine.
I already tried every single solutions from similar threads, like this one: How to solve npm error "npm ERR! code ELIFECYCLE" but nothing worked for me.
This is my package.json:
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
},
Just in case, here it's my webpack.mix.js:
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
])
.webpackConfig(require('./webpack.config'));
.deploy.sh:
# Enter maintenance mode
(php artisan down --message 'The app is being (quickly!) updated. Please try again in a minute.') || true
# Update branch
git fetch --all
git reset --hard origin/main
# Make storage writable
sudo chmod -R 777 ./storage
# Install dependencies based on lock file
composer install --no-interaction --prefer-dist --optimize-autoloader
# JS dependencies
npm install
# Migrate database
php artisan migrate --force
# Compile assets
npm run prod
# Clear cache
php artisan optimize
# Reload PHP to update opcache
echo "" | sudo -S service php-fpm reload
# Exit maintenance mode
php artisan up
echo "Application deployed!"
And finally the error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ec2-user/.npm/_logs/2021-01-08T18_49_06_563Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # prod: `npm run production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Thanks in advance.
In case that anyone is just going through the same and checked every other alternatives here, it was a server memory problem. We just had to clean it and we were ready to keep it going. Apparently after several deploys it ran out of space.

Can not import reactjs

I'm trying to import react, I wrote the following code:
import React from "react";
but when I write npm start in the terminal it shows me these errors:
> reactjs-basics#1.0.0 start /home/zx-coder/Downloads/reactjs-basics-master
> npm run build
> reactjs-basics#1.0.0 build /home/zx-coder/Downloads/reactjs-basics-master
> webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot
Hash: 2692c371e3a85309b95e Version: webpack 1.15.0 Time: 1020ms
Asset Size Chunks Chunk Names
bundle.js 166 kB 0 [emitted] main bundle.js.map 184 kB 0 [emitted] main
+ 37 hidden modules events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 127.0.0.1:8080
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1367:14)
at listenInCluster (net.js:1408:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1517:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
"/usr/bin/npm" "run" "build" npm ERR! node v8.10.0 npm ERR! npm
v3.5.2 npm ERR! code ELIFECYCLE npm ERR! reactjs-basics#1.0.0 build:
`webpack -d &&cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the reactjs-basics#1.0.0 build script 'webpack -d
&& cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --hot'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this
is most likely a problem with the reactjs-basics package, npm ERR! not
with npm itself. npm ERR! Tell the author that this fails on your
system: npm ERR! webpack -d && cp src/index.html dist/index.html
&& webpack-dev-server --content-base src/ --inline --hot npm ERR! You
can get information on how to open an issue for this project with: npm
ERR! npm bugs reactjs-basics npm ERR! Or if that isn't available,
you can get their info via: npm ERR! npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with anysupport request:
npm ERR!
/home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log
npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
"/usr/bin/npm" "start" npm ERR! node v8.10.0 npm ERR! npm v3.5.2 npm
ERR! code ELIFECYCLE npm ERR! reactjs-basics#1.0.0 start: `npm run
build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
reactjs-basics#1.0.0 start script 'npm run build'. npm ERR! Make sure
you have the latest version of node.js and npm installed. npm ERR! If
you do, this is most likely a problem with the reactjs-basics package,
npm ERR! not with npm itself. npm ERR! Tell the author that this fails
on your system: npm ERR! npm run build npm ERR! You can get
information on how to open an issue for this project with: npm ERR!
npm bugs reactjs-basics npm ERR! Or if that isn't available, you can
get their info via: npm ERR! npm owner ls reactjs-basics npm ERR!
There is likely additional logging output above.
npm ERR! Please include the following file with anysupport request:
npm ERR!
/home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log
The error is Error: listen EADDRINUSE 127.0.0.1:8080 which means there already is something that uses port 8080 on your machine, try changing the port webpack starts the dev server
solution 1: if your are beginner - just restart your PC.
solution 2: open task manager and kill all node instances.
alternatively you check if there is some other react app already running on port 8080 so you have to stop it
OR
you have to change your current app port to some other port.

Cannot build vue project

I'm trying to build my vue project and push it into github pages.
I'm trying to run npm run build but all I'm getting is this :
> my-domain#1.0.0 build /Users/macbookair/Workspace/fun/mine/web
> cross-env NODE_ENV=production webpack --progress --hide-modules
Hash: 2399923ef57865258a1f
Version: webpack 3.11.0
Time: 9252ms
Asset Size Chunks Chunk Names
build.js 740 kB 0 [emitted] [big] main
build.js.map 919 kB 0 [emitted] main
ERROR in build.js from UglifyJs
Unexpected token: punc (() [build.js:503,6]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! andre.js.org#1.0.0 build: `cross-env NODE_ENV=production webpack --progress --hide-modules`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the andre.js.org#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macbookair/.npm/_logs/2018-02-27T09_19_23_677Z-debug.log
I also tried to run npm run build; push-dir --dir=dist --branch=gh-pages --cleanup and all I'm getting is this :
> andre.js.org#1.0.0 build /Users/macbookair/Workspace/fun/mine/web
> cross-env NODE_ENV=production webpack --progress --hide-modules
Hash: 2399923ef57865258a1f
Version: webpack 3.11.0
Time: 9524ms
Asset Size Chunks Chunk Names
build.js 740 kB 0 [emitted] [big] main
build.js.map 919 kB 0 [emitted] main
ERROR in build.js from UglifyJs
Unexpected token: punc (() [build.js:503,6]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! andre.js.org#1.0.0 build: `cross-env NODE_ENV=production webpack --progress --hide-modules`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the andre.js.org#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macbookair/.npm/_logs/2018-02-27T09_22_29_715Z-debug.log
I don't really know how to build it since I'm new to Vue, I'm using the webpack-simple vue template
You can try this option:
https://github.com/creotip/vue-particles/issues/7
But maybe the better options will be reinstall npm
You use Version: webpack 3.11.0
Try to install latest version
$ npm i -D webpack#latest
$ npm run build

NPM scripts permission denied on chronos (chromebook shell)

I recently installed node on my chromebook. I have git cloned a basic node repo that is trying to run things like webpack, babel-node, and concurrently through npm scripts.
However, running webpack (in the same directory) works just fine.
I have run "sudo chmod -R 777 my_app" and it did not help.
Here is the error message:
chronos#localhost ~/Downloads/MODULE $ npm start
> my-glitch-app#0.0.1 start /home/chronos/user/Downloads/MODULE
> concurrently "webpack -w -p" "babel-node server.js"
sh: concurrently: Permission denied
npm ERR! Linux 3.18.0-14875-g438cb8ab27c6
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! my-glitch-app#0.0.1 start: `concurrently "webpack -w -p" "babel-node server.js"`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the my-glitch-app#0.0.1 start script 'concurrently "webpack -w -p" "babel-node server.js"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the my-glitch-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! concurrently "webpack -w -p" "babel-node server.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-glitch-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-glitch-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/chronos/user/Downloads/MODULE/npm-debug.log
following my comment above, sudo mount -o remount,exec /home/chronos/user seemed to work, but i have further anomalies in my case, so i'd be curious about peer experience

npm run dev command does not work on vuejs' hackernews example

I am trying to run the vue-hackernews-2.0 example from vuejs' github repository
In setup section it explains how to install the project:
# install dependencies
npm install # or yarn
# serve in dev mode, with hot reload at localhost:8080
npm run dev
# build for production
npm run build
# serve in production mode
npm start
I did npm install. After changing the port to 8888 in server.js I typed "npm run dev" on command line.
> vue-hackernews-2.0# dev D:\Users\212399486\WebstormProjects\vue-hackernews-2.0-master
> node server
server started at localhost:8888
DONE Compiled successfully in 16328ms 1:02:18 PM
DONE Compiled successfully in 17845ms 1:02:19 PM
webpack built bd162a76119031a85eed in 17845ms
When I go localhost:8888 It will just try to load for 1 min and then it fails, without anything on the console.
I thought I should also try "npm run build" and "npm start" so I also used two commands. "npm run build" successfully created the dist file.
But after "npm start" I get this error:
> vue-hackernews-2.0# start D:\Users\212399486\WebstormProjects\vue-hackernews-2.0-master
> cross-env NODE_ENV=production node server
module.js:471
throw err;
^
Error: Cannot find module './dist/vue-ssr-server-bundle.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\Users\212399486\WebstormProjects\vue-hackernews-2.0-master\server.js:41:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn node ENOENT
at notFoundError (D:\Users\212399486\WebstormProjects\vue-hackernews-2.0-master\node_modules\cross-spawn\lib\enoent.js:11:11)
at verifyENOENT (D:\Users\212399486\WebstormProjects\vue-hackernews-2.0-master\node_modules\cross-spawn\lib\enoent.js:46:16)
at ChildProcess.cp.emit (D:\Users\212399486\WebstormProjects\vue-hackernews-2.0-master\node_modules\cross-spawn\lib\enoent.js:33:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "D:\\Users\\212399486\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.2
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! vue-hackernews-2.0# start: `cross-env NODE_ENV=production node server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-hackernews-2.0# start script 'cross-env NODE_ENV=production node server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vue-hackernews-2.0 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=production node server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vue-hackernews-2.0
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vue-hackernews-2.0
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Users\212399486\WebstormProjects\vue-hackernews-2.0-master\npm-debug.log
Screenshot of dist folder:
package.json scripts:
"scripts": {
"dev": "node server",
"start": "cross-env NODE_ENV=production node server",
"build": "rimraf dist && npm run build:client && npm run build:server",
"build:client": "cross-env NODE_ENV=production webpack --config build/webpack.client.config.js --progress --hide-modules",
"build:server": "cross-env NODE_ENV=production webpack --config build/webpack.server.config.js --progress --hide-modules"
},
Requires Node.js 7+
I managed to make it work without any problems.
$node -v
v8.3.0
$npm -v
5.3.0
Change the default port successfully :
To change the default port you have to edit package.json scripts:
dev: cross-env PORT=8888 node server
start: cross-env PORT=8888 NODE_ENV=production node server
Then running npm run dev
> vue-hackernews-2.0# dev /home/emx/so/vue-hackernews-2.0
> cross-env PORT=8888 node server
server started at localhost:8888
you are using a version of node that is not supported. Your error point to node v6.11.2 see below.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "D:\\Users\\212399486\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.2
npm ERR! npm v3.10.8
vue-hackernews-2.0 requires Node.js 7+. Upgrade your node to a 7+ version and you should be fine. I'll also recommend to update your npm version.
See the answers to this question for details about how to update your node version, if you need instructions.

Categories

Resources