nodemon, webpack, vue, react: Could not load file C: \ Users \ your username \ AppData \ Roaming \ npm \ nodemon.psl. Because scripts are prohibited on this system

When using scaffolding to build a project, the prompt: Cannot load file C: \ Users \ your username \ AppData \ Roaming \ npm \ nodemon.psl. Because scripts are prohibited from running on this system ---- This type of error is reported here. The computer has insufficient permissions.
Reference: https://blog.csdn.net/weixin_41967475/article/details/105664942

The following are some screenshots for reference only!

nodemon: unable to load file:

Insert picture description here

vue: unable to load file:

vue: Unable to load file due to insufficient permissions

webpack: unable to load:

Insert picture description here

Solution

1. Search box => input: Powershell => selection: run as administrator

Insert picture description here

2.输入:set-ExecutionPolicy RemoteSigned

Insert picture description here

3. Select Y or A, then close

Most people perform the above three steps to perfectly solve the system permission problem; if the error cannot be identified, please read on!

Unrecognized error:

Insert picture description here
The above error is because the path of the script file is not found, which makes it unrecognizable. Global installation script, there are two ways to solve the above problems

Knowledge point supplement:
using npm installation module is divided into local installation and global installation.

Local installation: npm install express will be installed to the current project

Global installation: npm install express -g will be installed to the specified directory (node_global)

If the global directory node_global is not set, the globally installed files will be saved to C: \ Users \ your user name \ AppData \ Roaming \ npm
Reference: https://blog.csdn.net/weixin_41967475/article/details/105664942

method one:

1. Create node_global and node_cache (node ​​cache folder) in the nodejs installation directory

Insert picture description here

2. Set environment variables

User variable setting : Change the value of path in the user variable to C: \ nodejs \ node_global, there is no PATH, you can directly add

System variable : add variable NODE_PATH value is: C: \ nodejs \ node_modules

Note: The path of my nodejs file is C: \ nodejs; the default path is: C: \ Program Files \ nodejs; make the corresponding changes according to your installation path
Insert picture description here
Insert picture description here

3. Open cmd and execute

npm config set prefix “C:\nodejs\node_global”

npm config set cache “C:\nodejs\node_cache”
Insert picture description here

4. After executing npm install express -g, check the node_global folder

Insert picture description here
There is an express folder in the node_global folder, indicating that the global installation will be downloaded to the node_global folder by default.

5. Taobao npm mirroring improves package pulling speed

Default access server: npm official website foreign server https://registry.npmjs.org

Set Taobao mirror path (domestic server): npm config set registry https://registry.npm.taobao.org

View nodejs configuration information: npm config list

Delete mirror: npm config delete registry

6.cnpm increases the speed of pulling bags

npm install cnpm -g -registry=https://registry.npm.taobao.org

Test whether the installation is successful: cnpm -v

Method Two:

Since the global directory node_global is not set, the globally installed files will be saved to C: \ Users \ your user name \ AppData \ Roaming \ npm

1. User variable settings

Insert picture description here
Note: If the AppData folder cannot be found, it is because it is hidden; click View to check the hidden items, and the AppData folder can be found. The
Insert picture description here
above two methods are what I know in my current study. Welcome to correct me; if you have any questions, leave a message in the comment area


Thank you for reading here, if there are similar errors below, please read on!

On a friend's computer, after several uninstalls and reinstalls, and then follow the above method, it can't avoid "it", Error: EPERM: operation not permitted, open 'C: \ Program Files \ nodejs \ node_cache_cacache \ tmp \ dbdef943; find the tmp folder and find it is an empty folder, did not understand what caused the permissions problem. After uninstalling and reinstalling a few times, and installing nodejs near the end, it was found that Powershell first popped up a red error prompt, and then automatically shut down, flashed by.
Insert picture description here
Solution: Uninstall nodejs and source files, and install it by another path, which can avoid this error; for example: C: \ Program Files \ nodejs is changed to C: \ nodejs; the above problem is solved perfectly.

The reason for the error in the picture above is currently unknown. I look forward to Daniel's message!

Reference: https://blog.csdn.net/weixin_41967475/article/details/105664942

The front-end knowledge is changing with each passing day, and we need continuous exploration, and there are some bumps on the way of exploration. We must firmly believe and conquer and conquer them.

Send us a sentence that belongs to the front-end Xiaobai: Paying, there will not necessarily be gains; not paying, there will be no gains, and do n’t expect miracles!

Published 1 original article · won 9 · 227 views

Guess you like

Origin blog.csdn.net/weixin_41967475/article/details/105664942