Summary of errors that occurred when starting the Vue project

Summary of errors that occurred when starting the Vue project

Remember: when you open WebStorm, open it as an administrator

1. Install node_module failed

I used Taobao image -- >, which is not feasible. The root cause is that the version is incompatible

npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm install --registry https://registry.npm.taobao.org 

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-ppafapma-163722662023) (C: \ users \ ASUS \ appdata \ roaming \ typora \ typora user images \ 1637139934167. PNG)]

Solutions: - > you can also try solutions that can't be solved, because everyone's mistakes are different, and maybe you can succeed

  • Open in administrator mode: cannot be resolved

  • npm i: unable to resolve

  • Delete node_modules file, re npm install: unable to resolve

  • Delete the package-lock.json file and then execute the npm install command: it cannot be solved

  • Try again: it can't be solved

  • Using Taobao image, follow the following steps: solved

    There are in the project package.json File no node-modules  Operation steps
    
    1:  administrators cmd implement
    
    2: Install first nrm
    
    npm install nrm -g
    
    3: nrm ls   View use mirror
    
    4: nrm use taobao   Specify Taobao image
    
    5: If used cnpm   Installation required       Front if not used nrm switch ,Taobao image warehouse can also be specified here
    
    npm install -g cnpm --registry=https://registry.npm.taobao.org    
    
    6: cnpm install     install node-modules
    
    
2. Clear the cache -- > if you try to install for many times, please clear the cache or adjust your mentality and restart the computer
npm cache clean   -- error
npm cache clean --force --correct
3. Incompatible version

npm run serve failed to start

Question: Syntax Error: Error: PostCSS received undefined instead of CSS string

1. Solution: it cannot be solved

#Uninstall node SAS and sass loader
npm uninstall node-sass
npm uninstall sass-loader


#Install node SAS and sass loader
npm install node-sass@4.14.1
npm install sass-loader@8.0.0

2. Solution:

Try to reduce node version: v12.16.1 -- > nvm management tool needs to be downloaded

  • Uninstall node process:

1. First uninstall all the files in the node.exe directory, clean them thoroughly, and delete node.js in the control panel

2. Delete the path in the environment variable

3. Download nvm -- > because gihub login is very slow, you can directly search the nvm installation package to download it. If necessary, install the package

qq: 1519778695

4. After downloading, the detailed installation can be accessed: https://www.jb51.net/article/202124.htm

5. Pit: node succeeded, but npm failed

Configure the installation addresses of node and npm in settings under nvm folder, so that nvm can download node and npm directly from Taobao image when installing node and npm, and there may be no error. Then go back to the cmd window and reinstall nvm 13.11.0 (the version you want to download). At this time, node and npm are installed successfully
Add two lines after settings.txt:

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

6. Pit: both node and npm failed

  • The clear information shows that node and npm have been installed successfully, and nvm use 11.13.0, but the command of node and npm can not be found. According to the online data, it should be that he has not configured the node environment variable. After reading it, he does not configure it, but the configuration is still unsuccessful. In this case, he can only uninstall nvm, reinstall the software and try again. There are often problems when installing nvm in win10 system. Sometimes nvm is installed, but cmd cannot find the command by inputting nvm. Sometimes, even if node can be installed normally with nvm, access is denied by typing node command and npm command prompt. At this time, uninstall nvm and reinstall it in the same way.
  • There is no problem with the configuration, but there is still an error in the packaging operation. You can put the node_ Delete all dependent packages in modules, switch to the specified node version, and then restart npm(cnpm) i -d

7. Pit: node sass installation failed

gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python D:Program FilesPython38python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: D:Program FilesPython38python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];

reason:

print "%s.%s.%s" % sys.version_info[:3];

This is the syntax of python2.x version. If python3.x is installed locally, this error will be reported

resolvent:

1. Delete the package-lock.json file in the project, clear the cache and update the version number

rm ./package-lock.json  (If windows System, you can delete it manually)
# Under linux or windows cmd command window:
npm cache clear --force
npm install -g npm

2. Modify the version number of the dependent package in package-lock.json

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-uajnbbk2-163722662027) (C: \ users \ ASUS \ appdata \ roaming \ typora user images \ 163721846063. PNG)]

This is my version for reference, but it is not unique. You can only try to change the version one by one – > persistence can succeed

3. Rerun the npm install command to succeed

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-y6nh61yd-163722662028) (C: \ users \ ASUS \ appdata \ roaming \ typora user images \ 1637218995269. PNG)]

8.nvm common commands

nvm ls // View the installed nodejs version
nvm list available // View installable node versions
nvm install 11.13.0  // Install version 11.13.0
nvm use 11.13.0 // Use version 11.13.0
vm uninstall 11.13.0 // Uninstall version 11.13.0

able / / view the installable node versions

nvm install 11.13.0 / / install version 11.13.0

nvm use 11.13.0 / / use version 11.13.0

vm uninstall 11.13.0 / / uninstall version 11.13.0

Tags: node.js npm Vue.js

Posted on Thu, 18 Nov 2021 03:22:42 -0500 by zapa