Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
Install NPM packages from http or https:
npm config set registry https://registry.npmjs.org/

Sometimes because of filtering issues you need to download node packages from http so make sure to make it http:
npm config set registry http://registry.npmjs.org/

#node #npm #shit #installation #config
If you get the below error for cross device link when installing npm on container:
npm WARN optional Skipping failed optional dependency /webpack/watchpack/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.3.0
npm ERR! npm v3.10.3
npm ERR! path /app/node_modules/istanbul/node_modules/abbrev
npm ERR! code EXDEV
npm ERR! errno -18
npm ERR! syscall rename

npm ERR! EXDEV: cross-device link not permitted, rename '/app/node_modules/istanbul/node_modules/abbrev' -> '/app/node_modules/abbrev'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 238


To solve this problem, put the below line of code before any npm command:
RUN cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs-extra/ -e s/fs.rename/fs.move/ ./lib/utils/rename.js


reference: https://github.com/npm/npm/issues/13306
#npm #docker #container #cross_device
Preventing installation of devDependencies node modules:

npm install in the package directory installs the dependencies in the local node_modules folder.

In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.

By default, npm install will install all modules listed as dependencies in package.json.

With the --production flag (or when the NODE_ENV environment variable is set to production`), `npm will not install modules listed in devDependencies.

#node #npm #package_json #devDependencies #NODE_ENV
How to create a an application for your platform? Let's say an EXE file for windows and .app for MAC or a binary for linux.

I suppose you have nodejs and npm already installed. You need to install nativefier node module using the command below first:

npm install -g nativefier

Now you can generate a native app from your website using the command below:

nativefier "https://www.google.com/" --name="Google"

There are many parameters you can give to nativefier in order to set custom settings on it. Check nativefier --help for that.

#nativefier #nodejs #npm #electron #mac #windows #exe