Tag Archives: nodejs

EPERM: operation not permitted, symlink ‘../../’

The original address: http://www.zgljl2012.com/post-post/


Run in Windows10

grunt symlink

Error:

PERM: operation not permitted, symlink '../../'

This is because there are no permissions.
The solution
Press the shortcut Win + X, select “== command prompt (administrator) ==”, then enter your target folder in the window to perform the desired action. In this way, you can obtain the administrator’s permission to operate.

Copy node causes NPM execution error: cannot find module ‘/ / lib / utils/ unsupported.js ‘

Copy node causes NPM execution error: Cannot find Module ‘.. /lib/utils/unsupported.js’

    execute NPM –version command times error, as follows
[exec] Error: Cannot find module '../lib/utils/unsupported.js'
[exec] Require stack:
[exec] - /home/jenkins/workspace/324970/eis-product/eis-ui/eis-ui-app-pc/node-exelib/bin/npm
[exec]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
[exec]     at Function.Module._load (internal/modules/cjs/loader.js:864:27)
[exec]     at Module.require (internal/modules/cjs/loader.js:1044:19)
[exec]     at require (internal/modules/cjs/helpers.js:77:18)
[exec]     at /home/jenkins/workspace/324970/eis-product/eis-ui/eis-ui-app-pc/node-exelib/bin/npm:19:21
[exec]     at Object.<anonymous> (/home/jenkins/workspace/324970/eis-product/eis-ui/eis-ui-app-pc/node-exelib/bin/npm:153:3)
[exec]     at Module._compile (internal/modules/cjs/loader.js:1158:30)
[exec]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
[exec]     at Module.load (internal/modules/cjs/loader.js:1002:32)
[exec]     at Function.Module._load (internal/modules/cjs/loader.js:901:14) {
[exec]   code: 'MODULE_NOT_FOUND',
[exec]   requireStack: [
[exec]     '/home/jenkins/workspace/324970/eis-product/eis-ui/eis-ui-app-pc/node-exelib/bin/npm'
[exec]   ]
[exec] }
[exec] Result: 1
    after verification, normally NPM is a soft connection, but through zip packaging, and then decompressed NPM becomes the actual contents of the npm-cli.js file, so no responsive module can be found when executing the script. Solution: You can use the tar command to package.

Normal conditions:

total 45148
-rwxr-xr-x 1 1001 1001 46228688 Feb 18 12:35 node
lrwxrwxrwx 1 1001 1001       38 Feb 18 12:35 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 1001 1001       38 Feb 18 12:35 npx -> ../lib/node_modules/npm/bin/npx-cli.js
lrwxrwxrwx 1 1001 1001       35 Mar  2 17:51 vuepress -> ../lib/node_modules/vuepress/cli.js 

Abnormal conditions (after decompression by ZIP compression) :

total 45164
-rwxr-xr-x 1 root root 46228688 Mar  2 17:53 node
-rwxr-xr-x 1 root root     4615 Mar  2 17:53 npm
-rwxr-xr-x 1 root root      177 Mar  2 17:53 npx
-rwxr-xr-x 1 root root      713 Mar  2 17:53 vuepress

Nodejs exception error: listen eacces 127.0.0.1:8000

This article is reprinted, if you do not want to infringe copyright, please timely inform
The original address to http://blog.csdn.net/y2010081134/article/details/72800812
Exception information

Error: listen EACCES 127.0.0.1:8000
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at Server._listen2 (net.js:1245:19)
    at listen (net.js:1294:10)
    at net.js:1404:9
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `http-server ./app -a localhost -p 8000 -c-1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'http-server ./app -a localhost -p 8000 -c-1'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     http-server ./app -a localhost -p 8000 -c-1
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-phonecat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\Git\Repository\angular-phonecat\npm-debug.log

The solution


The exception is caused by 8000 port being occupied. Check the 8000 port being occupied under Windows

E:\Git\Repository\angular-phonecat>netstat -ano|findstr "8000"
  TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING       18480
  TCP    127.0.0.1:8000         127.0.0.1:50236        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50237        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50238        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50239        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50240        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50286        TIME_WAIT       0
  TCP    127.0.0.1:50285        127.0.0.1:8000         TIME_WAIT       0
  UDP    0.0.0.0:8000           *:*                                    18480

Because process 0 is a system process, executing “Taskkill/PID 0” will not kill it. So, find another way to change the port, as follows:

Under node’s installation root, find package.json, search 8000, and replace with 8888


 

Then execute the command NPM Start from the command line, and it starts successfully

Enter it in the browser
http://localhost:8888
, you can see the successful access

[nodejs] error request aborted after request routing in post mode

The introduction of
I added a new route to my project to try to add some functionality. After the function code was added, I found that the page was loading all the time when I submitted the POST request. At this time, I went to the console and reported something wrong: BadRequestError: Request Aborted
This makes me very confused. Separate test function code and the existing project when it is working well, but can be combined together to die, what is the reason?
why
Encounter the problem first Baidu, but goose Baidu a day also did not Baidu to, basically still do not know what the problem is only an error information request aborted also do not know Baidu what…
Then you can only hard look at the error message in an attempt to discover the cause. First look at the error message: \node_modules\raw-body\index.js:231:10


annotation of these two lines of code is ok, but the problem comes, I can’t change the processing library, how much code should be changed.
Then I still can’t find the reason, and finally in the chat with the boss was the boss out of ! Sure enough, a proper route was run before the function code, and post requests were processed using express-formidable, a formidable component that clashed between the body-parser and express-formidable, causing Request Aborted

Problems in compiling and using node FFI under electron

The project needed to load DLLS in NodeJS, learned that the easiest solution was to use Node-FFI, and then started a half-day of novice tramp.
This problem occurs when NPM install FFI sets up the project

error: no member named 'ForceSet' in 'v8::Object'

After checking on the official website, the author indicated that FFI does not support nodeJS 10 or above at present. Then I researched and walked through a lot of pothoods and found electronrebuild, which actually automatically goes down the corresponding Node header file and lib according to the electron version and platform version used in your project, and successfully solved the COMPILATION problem of FFI. After that, I tried to package and release, but there was another problem. Debugging code in Vscode was running well, and lifting directly with Electron. Exe would indicate that dynamic library loading failed

ffi.Library('./libfactorial'

This DLL loading code, please use the absolute path, modify the dynamic scheme, done

Can’t find Python executable “D:\python3\python.exe”, you can set the PYTHON env variable.

An error
When installing APpium with NPM under Win10, the following error is reported:

Can't find Python executable "D:\Anaconda3\python.exe", you can set the PYTHON env variable.

solution
1. Set the Python execution file path. 2, to use python version 2.7.
Methods a
Set the global variable in Windows PYTHON to be the absolute path of PYTHON 2.7, for example:

D:\Anaconda2\python.exe

Set variables:

set PYTHONPATH=%PYTHON%

Method 2

npm config

events.js:160 throw er; // Unhandled ‘error’ event ^ Error: write after end at Serv

In the process of writing nodeJS project, When I deleted some data in the database, I made the judgment of various conditions first, and then deleted the data after meeting them. The first time it is deleted, it can be successfully deleted, then repeat the action of deleting the last time, the following error will occur:
Events. Js: 160
throw er; // Unhandled ‘error’ event
^

error: Write after end
the at ServerResponse. OutgoingMessage. Write (_http_outgoing. Js: 439:15)
the at F: \ \ userHandler SL js: 355:35
the at F: \ \ mon SL js: 84:5
the at handleCallback (F:\SL\node_modules\ lib\utils.js:120:56)
at F:\SL\ node_modules.js :1243:5
at F:\SL\node_modules\mongodb-core\lib\connection\pool.js:461:18
at Combinedtickcallback (internal/process/next_tick.js:67:7)
at process._tickcallback (internal/process/next_tick.js:98:9)

Some said that nodeJS version is too high, and some dropped from 7 to 6. My version is 6.

Solutions:
I add a return after each condition; Statement to solve the above problem.

ER_ACCESS_DENIED_ERROR: Access denied for user ‘root‘@‘localhost‘ (using password: NO)

ER_ACCESS_DENIED_ERROR: Access Denied for user ‘root’@’localhost’ (using password: NO) How to handle this?
Recently, redo node. Js connect mysql, this problem has been appear, can start the project, is has been submitted to the error and write the information also can not add in mysql, then baidu search, most above all, what password is modified, said of the fog, I didn’t do this, then in a pet write before all deleted, I knocked again and again finally found an error or accidentally got the wrong number, and then see the reason for the error.
In Vscode, it’s the red box, it was password, it’s PWD, so let’s just change PWD to password.

Cannot find module ‘body-parser’

bug:Cannot find module ‘body-parser’
For obvious reasons, this module isn’t available, and if you look in the node_modules directory, it isn’t

Solution: Reinstall the module;
CMD switch to node installation directory:

npm install --save body-parser

How to solve the problem of Cannot find module’npmlog’ when installing nodejs under Linux

I used Ubuntu version of Linux, downloaded nodeJS6 executable file compression package from nodeJS official website, extracted it into folder under the Window, and uploaded it to Linux server through WinSCP.
Configure environment variables:
Add a nodejs.sh script under /etc/profile.d/, which reads as follows:

export NODE_HOME=/home/TECS/nodejs/node-v6.11.1-linux-x64
export PATH=$PATH:$NODE_HOME/bin
export NODE_PATH=$NODE_HOME/lib/node_modules

If you want to make the configuration work without restarting the machine, repeat the three commands from the command line.
Running NPM-V at this time Cannot find Module ‘NPMLOG’ error.
The solution
CD command enter /home/TECS/nodejs/node-v6.11.1-linux-x64/bin then execute the following command to establish the soft connection:

ln -s ../lib/node_modules/npm/bin/npm-cli.js

The generated NPM-cli.JS soft connection is then renamed to NPM. The original NPM file is not available.

mv npm-cli.js npm