Why does change my mix-manifest file when i run npm run dev code? - mysql

When i run this code npm run dev in my Laravel+Vue.js project it changing my mix-manifest.json file. I dont want this. What can i do?
I want to add static values to mix-manifest.json or dynamic values.

You shouldn't edit this file. It is automatically regenerated when you run npm run dev. Think about other solution.

Related

How to run 'polymer build' in visualstudio.com

I could, after a lot of effort, create a step in the job where I install (correctly) the polymer CLI.
Now I would like to build my client project, but I tried with command lines, npm commands, whatever, I couldn't find the correct definition to obtain a proper build.
In this picture, I show the error that happens in the command line 'polymer build'.
How could I obtain the desired result?
Thanks in advance...
The Tool is polymer and Arguments is build:

DiscordJS, Gulp reload bot on file save?

I just started messing around with Discordjs and I'm working on just a super simple bot example, but the most annoying thing is whenever I make any changes I need to stop the bot in command line and execute the command to come back online in order for any of my code changes to take affect. Is there any way to automate this process? lets say I make a change to bot.js, would there be a way for something like gulp to detect this and restart the bot?
You could use something like nodemon (http://nodemon.io/).
Install it by running: npm install -g nodemon. This will install it globally on your computer. Then just run nodemon on the console instead of node myfilehere.js.
Make sure the file you are running with node myfilehere.js is the same name on package.json under "main"

json file location in command prompt

I am trying angularjs-2 for the first time from the example found here
and everything was working fine until I came to a point where the author has written something like this
Now open the package.json file location in command prompt and execute
the below command to load the required modules and supported files
which are mentioned in the package.json file.
npm start
after reading this I open command prompt by pressing window+R and write cmd
and I enter the following path
E:....\nodejs with angular2 testing\nodejs with
angularjs2\nodejs with angularjs2\
but i am not able to do anything after this point
how can i execute the package from command prompt,?
i tried the same with developer command promt but facing the same issue,
hey guys i know i am bad in english but please i need help here
First you need to have nodejs in your system.
If you don't have nodejs, then download it. which shifts npm with it. [It is similar kind of stuff what nuget does in VisualStudio.]
As you mentioned package.json is already there in your project then you need to got to you Application folder in command prompt to install packages by running npm install.
For example : If your App folder is in E:\Project\Myangular2App,
then after opening Command Prompt with window+R, navigate to E drive by E:, then navigate to your App folder by cd Project\Myangular2App and run npm install. This will install all the packages mentioned in package.json
start seems to be a script configured in your package.json which probably runs something else.
Please state if npm (the node package manager) runs on your CLI without any argument. If not you have to get npm working first. It has to be in your $PATH variable in order to function anywhere.

Transparently install npm packages offline, from a custom filesystem directory

Editor's note: The question's original title was "Use npm install to install node modules stored on a local directory", which made the desire to transparently redefine the installation source less obvious. Therefore, some existing answers suggest solutions based on modifying the installation process.
I know this is a simple thing, but I'm quite new to anything in this area so after searching around and constantly finding answers that weren't really what I want I figured I'd just ask directly.
I currently have a process that is run in directory FOO that calls npm install. Directory FOO contains a package.json and a npm-shrinkwrap.json file to specify the modules (bluebird, extend, and mysql in this case but it doesn't really matter) and versions. This all works perfectly fine.
But now instead of reaching out to the internet to get the modules I want to have them stored in local directory BAR and have the process in foo use npm to install them from there. I can not store them permanently in FOO but I can in BAR for reasons outside my control. I know this is relatively simple but I can't seem to get the right set of commands down. Thanks for the help.
Note: This answer originally suggested only redefining the cache location. While that works in principle, npm still tries to contact the network for each package, causing excessive delays.
I assume your intent is to transparently change the installation source: in other words: you don't want to change your package, you simply want to call npm install as before, but have the packages be installed from your custom filesystem location, offline (without the need for an Internet connection).
There are two pieces to the puzzle:
Redefine npm's cache filesystem location (where previously downloaded packages are cached) to point to your custom location:
Note that cached packages are stored in a specific way: the package.json file is stored in subfolder package, and the zipped package as a whole as package.tgz. It's easiest to copy packages from your existing cache to your custom location, or to simply install additionally needed ones while you have an Internet connection, which caches them automatically.
For transparent use (npm install can be called as usual):
By setting the configuration item globally:
npm config set cache '/path/to/BAR'
Note that this will take effect for all npm operations, persistently.
Via an environment variable (which can be scoped to a script or even a single command):
export npm_config_cache='/path/to/BAR'
npm_config_cache='path/to/BAR' npm install
Ad-hoc use, via a command-line option:
npm install --cache /path/to/BAR
Force npm to use cached packages:
Currently, that requires a workaround via the cache-min configuration item.
A more direct feature, such as via an --offline switch has been a feature request for years - see https://github.com/npm/npm/issues/2568
The trick is to set cache-min to a very high value, so that all packages in the cache are considered fresh and served from there:
For transparent use (npm install can be called as usual):
By setting the configuration item globally:
npm config set cache-min 9999999999
Note that this will take effect for all npm operations, persistently.
Via an environment variable (which can be scoped to a script or even a single command):
export npm_config_cache_min=9999999999
npm_config_cache_min=9999999999 npm install
Ad-hoc use, via a command-line option:
npm install --cache-min 9999999999
Assuming you've set cache-min globally or through an environment variable,
running npm install should now serve the packages straight from your custom cache location.
Caveats:
This assumes that all packages your npm install needs are available in your custom location; trying to install a package that isn't in the cache will obviously fail without an Internet connection.
Conversely, if you do have Internet access but want to prevent npm from using it to fetch packages - which it still will attempt if a package is not found in the cache - you must change the registry configuration item to something invalid so as to force the online installation attempt to fail; e.g.:
export npm_config_registry=http://example.org
Note that the URL must exist to avoid delays while npm tries to connect to it; while you could set the value to something syntactically invalid (e.g., none), npm will then issue a warning on every use.
Sample bash script:
#!/usr/bin/env bash
# Set environment variables that set npm configuration items to:
# - redefine the location of the cache folder
# - make npm look in the cache only (assuming the packages are there)
# Note that by doing this inside a script the changes will only take effect
# in the script and NOT persist.
export npm_config_cache='/path/to/BAR' npm_config_cache_min=9999999999
# Now cd to your package and invoke `npm install` as usual.
cd '/path/to/project'
npm install
You might want to try npm link. You could:
download the dependency
run npm link from the dependency's directory
run npm link mycrazydependency from you project
Detail here: https://docs.npmjs.com/cli/link
If a shrink wrap file is present then package.json is ignored. What you need to do is change the URL they are being retrieved from using a find and replace operation like sed .... However I'm not sure changing the URL to a file:/// syntax is valid but give it a go.

Is there an option to have Bower and NPM automatically update their packages in Visual Studio 2015 when their source-controlled .json files change?

Currently, when you Get Latest from source control, and the bower.json or package.json files have changed, you still need to open and make a minor change to the file and re-save it in order for VS to be aware of the change and execute NPM or bower and pull updates. Ideally, it would detect the change and execute it immediately upon getting the latest .json files. I can understand the case for not wanting this to be the default behavior, but without this, our entire dev team needs to be notified and perform the extra steps whenever a .json file change is checked in (fairly often).
Is there an environment setting in VS that impacts this, or a feasible workaround that anyone is aware of?
No, there is no such setting in VS IDE.
As you figured out that when you save any changes to the package.json or bower.json file, Visual Studio automatically install or restore all packages. However, the auto check is not triggered when you get file from TFS version control.
You can, however, create a licenser to license to the GettingEventHandler event. Once the event is triggered, run the scripts to install the updates:
npm install -g bower-check-updates
npm-check-updates -u
bower-check-updates -u
npm install