npm Frequently Asked Questions

1, the domestic use is preferably switched to the mirror taobao provided:

     Reference website: https://npm.taobao.org/

* Default http://registry.npmjs.org instability in the country * 

npm the SET Registry config = https://registry.npm.taobao.org

2, npm install error does not exist package.json

  

/ * - f represents the force of meaning, without this, npm will let you enter a bunch of information, such as name, version and the like, if only doing experiments small demo, direct -f, npm help you initialize package.json, and filled with all kinds of defaults, easy. * / 
Npm forced the init -f // initialization file 

npm install Bluebird --save 

/ * -save said it would depend on the list of installed packages added to the meaning, you can look in the dependencies package.json field. Later run npm install, the installation will be dependent on all down. If not -save, nothing will be installed. * /

3, Laravel npm install syscall symlink error reasons and solutions

  The reason is that the default npm will install the components using symbolic links, that we often use a soft link in linux system (ln -s) or a hard link (ln), but some file systems do not support file links, such as Windows (or disabled for security reasons), sometimes linux system running on windows hard disk partitions do not support the link, such as virtualbox disabled by default in the shared folder using symbolic links on windows host, of course, for security reasons.
So npm install default need to use symbolic link, and this in itself is also a feature of npm more important, but if our system does not support this property, it will report the above error.
Solution is to add a parameter, the --no-bin-links in npm install time, that npm install --no-bin-links:
That is, in order to prevent syscall symlink error if you are in windows use npm, or even in the homestead years, but the host is windows, so each time you perform a npm install or update components related to command, to be followed by the --no-bin-links, such as npm update you want to - -no-bin-links, you have to npm rebuild node-sass -no-bin -links, really very troublesome
, of course, you can also set the overall look npm, it no longer uses the default file linking feature, execute:
npm config set bin-links false

  

4, no such file or directory, scandir '/ home / vagrant / Code / sample / node_modules / node-sass / vendor'

  Npm regenerated using node-saaa

  npm rebuild node-sass  --no-bin-links

vagrant box Linux in windows host in the use npm install, because the host os does not support the symbol link linux, so you must use the --no-bin-links command

In fact, the windows can also use the file link, but the condition is that the job must have administrator privileges, if you perform before vagrant up, when you open the command line, use administrator rights to open, in fact npm install without --no-bin-links are not being given,


5, Laravel execution npm run dev error, suggesting that cross-env can not find (not found) solution
  
  First enter package.json file will delete all cross-env under the scripts, (can not be deleted under devDependencies)

Guess you like

Origin www.cnblogs.com/fogwang/p/12120329.html