Tag Archives: node

Project startup error: related to modules and node versions

programme1:

1. The code uses the master branch.

2. Delete node_ module ,   Yarn lock file, package lock file.

3. Use NPM install or yarn

programme2

1. Find other people’s nodes_ modules

2. Look for other people’s yarn.lock and package-lock.json files and try to install yarn again   And NPM install

3. Open the process management program and close the applications that occupy a large amount of memory in the computer

 

programme3

1. Including node version upgrade

2. Expand node memory: export node_ OPTIONS=”–max-old-space-size=10240″

 

programme4:

Close the project, restart the computer and operate again

Nuget cannot find the asset file project.assets.json [How to Solve]

Assets file '<path>\project.assets.json' not found. Run a NuGet package restore to generate this file.

or

C:\Program Files\dotnet\sdk\2.1.504\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198, 5): error NETSDK1004: 找不到资产文件 project.assets.json

Solution:

Use cmd cd in  .net core project files
Run dotnet build

node env: node\r: No such file or directory

Recently, I was writing a command line tool
it works normally when using NPM link . However, after Ctrl + s is saved, an error env: node \ R: no such file or directory is reported. You need to NPM link again. Do you have to link every time you modify it
I’m surprised that the target file of link is the same as the source file. Why can’t it be saved

Causes and Solutions

Pay attention to the character ‘\ R’. The parser actually takes the newline character as part of the path! Embarrassing
change the line feed method CRLF to LF

Reference

https://github.com/TarikHuber/rmw-shell/issues/20#issuecomment -441359468

Node: background NPM start error: mongooseserverselection error: connect econnrefused 127.0.0.1:27017

Website content quality is poor, distribution efficiency is too low how to do?Huawei engineers offer 5 unique skills>>>

Hello, I’m mabbago

This morning, I was ready to open the project continuation code, but I suddenly reported an error: mongoose server selection error: connect econrefused 127.0.0.1:27017

The error code is roughly like this:
(to illustrate, the picture is from the blogger. Thank you for your tips, otherwise I don't know the problem. Because it was handled at once, and I didn't have time to take a screenshot of the content of my own error report, which was the same as his, so I borrowed the picture)

this made me confused, and I had been doing well all the time. Why did I suddenly report an error

Then we checked Baidu and found that mongodb service was shut down

It's easy to find out why

start the task manager → find mongodb → right-click → select Start

As shown in the figure:

then open CMD , enter the command NPM start to open the background service

-----------------------end--------------------------

node env: node\r: No such file or directory

Recently, I am writing a command line tool
when using NPM link , it can work normally. However, if you save Ctrl + s and run it again, you will report an error env: node/R: no such file or directory. You need to NPM link again. Do you need to link every time you modify it
it’s strange that the target file is the same as the source file, so why can’t it be saved

Causes and Solutions

Pay attention to the character ‘R’. The parser takes the newline character as part of the path! Embarrassed
change CRLF to LF

Reference

https://github.com/TarikHuber/rmw-shell/issues/20#issuecomment -441359468

Node is not handled by link after installation [How to Solve]

Warning:

Error: The brew link step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink share/doc/node/gdbinit /usr/local/share/doc/node is not writable.

sudo chmod 776 /usr/local/lib
brew link --overwrite node
Outputs: Linking /usr/local/Cellar/node/9.6.1... 49 symlinks created
sudo chmod 755 /usr/local/lib

Failed to create symbolic link ‘/usr/bin/utserver’: File exists with Error: Cannot find…

With multi-dimensional model as the core, let the factory digital transformation and upgrading “within reach”>>>

Nodejs download address (official website)

https://nodejs.org/en/download/

After downloading, it is a tar, XZ compressed package

Upload the compressed package to the Linux server through xftp

If I put it in the root directory

Using xshell to connect to remote server

CD to the current directory (the default is the root directory)

Execute the following command to unzip

Tar xvjf node-v10.16.3-linux-x64.tar.xz or tar XF node-v10.16.3-linux-x64.tar.xz

The difference is that xvjf can see the decompression, but XF can’t

xvJf

xf

Establishing a soft connection

Configure node

ln -s /root/node-v10.16.3-linux-x64/bin/node /usr/local/bin/node

Configure NPM

ln -s /root/node-v10.16.3-linux-x64/bin/npm /usr/local/bin/npm

PS: pay attention

/Root/node-v10.16.3-linux-x64/is the installation path of node

The last English of the soft connection should correspond to the English after bin (note that there is a space in the middle, such as/node/USR)

If the following error occurs when executing the command, such as NPM install Vue

Error: Cannot find module ‘/root/node-v10.16.3-linux-x64/install’

Then it’s possible that you made a mistake when setting up the soft connection

PS: pay attention

If a soft connection is established (the last English of the soft connection should follow bin, for example: ln – S/root/node-v10.16.3-linux-x64/bin/node/usr/local/bin/NPM)

Congratulations (when you execute node – V or NPM – V, you will report an error when you execute NPM install Vue)

At this time, you may be re executing the soft connection(

ln: failed to create symbolic link ‘/usr/local/bin/npm’: File exists)

The reason is already related in your/usr/local/bin/NPM

terms of settlement:

ln -sf /root/node-v10.16.3-linux-x64/bin/npm /usr/local/bin/npm

The references are as follows:

https://askubuntu.com/questions/379647/failed-to-create-symbolic-link-usr-bin-utserver-file-exists

OK, solve it

To configure Taobao image

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

Configure soft connection

ln -s /root/node-v10.16.3-linux-x64/bin/cnpm /usr/local/bin/cnpm

Failed to install node with. MSI, rolling back action (Reprint)

Reprint address: https://blog.csdn.net/qq_ 33295622/article/details/52956369
the situation shown in the figure above appears when the node is reinstalled, and the solutions are as follows:
1. Download the stable version of node.exe from the official website, and select 32bit or 64bit according to the actual situation

here I choose 64bit, After downloading, get node.exe
2 http://nodejs.org/dist/npm/ Download the latest version of NPM
3. Create the node.js folder under the C:: program files file, and put the node.exe and the unzipped NPM in it
4. Configure environment variables, right-click computer – properties – advanced system settings – environment variables, and add C:: program files – node.js to the user variable path, Add a new variable node to the system variable_ Path, and the value of the variable is C:// program files \ \ node. JS \ \ node_ Modules


5. At this time, you can enter CMD in windows search, open cmd.exe, enter node – V and NPM – V respectively

the NPM version I download here is 1.4.9, enter NPM install [email protected] -g. You can download the NPM of the specified version to get the result above
so far, node.js and NPM have been successfully installed

After installing node on MAC, enter node – V to prompt node command not found

Download the. PKG file of the node from the official website to install the node. After installation, enter NPM – V and node – V in the MAC terminal to prompt command not found. Refer to the method on the Internet, and finally get the solution

Step 1: create. Bash_ Profile file, ~ means in the ~ directory,. Means hidden file. Open the terminal and enter the following command

touch ~/.bash_profile  

Step 2: open. Bash_ The input command is as follows:

open -t ~/.bash_profile 

Step 3: a blank text edit box will pop up. Edit the first line in the text edit box

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin  

Command + s saves the file

Step 4: save. Bash_ Profile file, enter the command:

source .bash_profile  

Step 5: enter NPM – V or node – V again to see the version number~

Node uses SSH2 SFTP Client to upload and download FTP files

Operating environment.

win7; node 10.15.1

The implementation steps are as follows

Step 1: Installation ssh2-sftp-client

npm install ssh2-sftp-client
// or
yarn add ssh2-sftp-client

Step 2: code implementation

 1 let Client = require('ssh2-sftp-client');
 2 
 3 function put(localPath, romotePath) {
 4     let sftp = new Client();
 5     sftp.connect({
 6         host: 'xx.xx.xx.xx', // Servers IP
 7         port: '22',
 8         username: 'xxxx',
 9         password: 'xxxxxx'
10     }).then(() => {
11         // upload
12         // return sftp.fastPut(localPath, romotePath);
13         // Download
14         return sftp.get(localPath, romotePath);
15     }).then((data) => {
16         // console.log(localPath + "Uploaded");
17         console.log(localPath + "Downloaded");
18         sftp.end();
19     }).catch((err) => {
20         console.log(err, 'catch error');
21     });
22 }
23 
24 let srcPath = 'D:\\MyDisk\\my-project\\node\\file\\test-copy.txt',
25     localPath = path.join(__dirname, 'test.txt'),
26     romotePath = '/home/xx/xx/webapps/xx/test.txt';
27 
28 // Upload file
29 // The first parameter is the local path of the file to be uploaded; the second parameter is the address where the server is stored
30 // put(localPath, romotePath);
31 // Download the file
32 // The first parameter is the address of the server where the file to be downloaded is stored; the second parameter is the local path
33 put(romotePath, srcPath);

note:

1. When uploading files, the fastput method is used, and the put method is used to upload files and report errors

2. SSH2 sfttp client official website document address