Tag Archives: NPM install error

[Solved] npm install Error: error code ERR_SOCKET_TIMEOUT

1. Error information

New project, Vue + element, NPM install, The error information reported at that time is as follows.

error code ERR_SOCKET_TIMEOUT
9673 error network Socket timeout
9674 error network This is a problem related to network connectivity.
9674 error network In most cases you are behind a proxy or have bad network settings.
9674 error network
9674 error network If you are behind a proxy, please make sure that the
9674 error network 'proxy' config is set properly.  See: 'npm help config'
9675 verbose exit 1
9676 timing npm Completed in 545124ms
9677 verbose unfinished npm timer reify 1661242562981
9678 verbose unfinished npm timer reify:unpack 1661242811008
9679 verbose unfinished npm timer reifyNode:node_modules/svgo 1661242811170
9680 verbose code 1

2. Solutions

//Step 1


npm install webpack webpack-cli --global



//Step 2
npm install rxjs



//Step 3
npm install webpack webpack-cli --global



//Finally, direct boot success
npm run dev 

 

[Solved] npm install Error: Error: EACCES: permission denied

Questions

When: NPM install @sentry/cli -g is executed as root, an error is reported:

npm ERR! Error: EACCES: permission denied, mkdir '/root/.npm/sentry-cli'

Cause

npm does not support running as root for security reasons. Even if you run it as root, npm will automatically redirect to a user named nobody, who has almost no privileges. In this case, if there are operations in the script that require permissions, such as writing files (especially to /root/.node-gyp), it will crash.

To avoid this, either follow the npm rules and create a privileged user specifically for running npm, or add the –unsafe-perm argument so that it doesn’t switch to nobody and runs as whatever user it is, even if it’s root.

 

Solution

Add parameter after executing command: –unsafe-perm

npm install --unsafe-perm @sentry/cli -g

[Solved] NPM install error: Maximum call stack size exceeded

1. Scene reproduction

Today, I wanted to pull someone else’s code to have a look, and then NPM install reported this error: “maximum call stack size exceeded”. I haven’t seen this error before, and finally found a solution.

2. Solution

1. Upgrade NPM, NPM install – G NPM
2 Re execute, NPM/cnpm install
3 If not, try clearing the NPM cache. NPM cache clean — force
4 Re execute, NPM/cnpm install

NPM install Error: gyp ERR! stack Error: Could not find any Python installation to use

When the Vue project uses NPM install as a dependency, the following error is reported:

gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - "python3" is not in PATH or produced an error
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - "python" is not in PATH or produced an error
gyp verb find Python checking if "python2" can be used
gyp verb find Python - executing "python2" to get executable path
gyp verb find Python - "python2" is not in PATH or produced an error
gyp verb find Python checking if Python is C:\Python37\python.exe
gyp verb find Python - executing "C:\Python37\python.exe" to get version
gyp verb find Python - "C:\Python37\python.exe" could not be run
gyp verb find Python checking if Python is C:\Python27\python.exe
gyp verb find Python - executing "C:\Python27\python.exe" to get version
gyp verb find Python - "C:\Python27\python.exe" could not be run
gyp verb find Python checking if the py launcher can be used to find Python
gyp verb find Python - executing "py.exe" to get Python executable path
gyp verb find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (E:\project\DBApi-master\dbapi-ui\node_modules\node-gyp\lib\find-python.js:302:47)
gyp ERR! stack     at PythonFinder.runChecks (E:\project\DBApi-master\dbapi-ui\node_modules\node-gyp\lib\find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (E:\project\DBApi-master\dbapi-ui\node_modules\node-gyp\lib\find-python.js:200:18)
gyp ERR! stack     at PythonFinder.execFileCallback (E:\project\DBApi-master\dbapi-ui\node_modules\node-gyp\lib\find-python.js:266:16)
gyp ERR! stack     at exithandler (child_process.js:390:5)
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:402:5)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)     
gyp ERR! stack     at onErrorNT (internal/child_process.js:469:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:82:21)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "D:\\nodejs\\node.exe" "E:\\project\\DBApi-master\\dbapi-ui\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\project\DBApi-master\dbapi-ui\node_modules\node-sass
gyp ERR! node -v v14.18.1
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\WRD\AppData\Roaming\npm-cache\_logs\2021-10-20T05_42_34_767Z-debug.log 

This is due to the lack of Python dependencies. After downloading and installing on the python official website, delete the dependencies and re execute NPM install

[Solved] Npm install Error: verbose stack Error: unable to resolve dependency tree

[environment]

[email protected]

[email protected]

1. Analysis reason:

After investigation, 1. It is found that there is peer dependency in package.json, indicating the version of angular 7. X, which is incompatible with the version of angular 8. X that the current project depends on, resulting in compilation errors.

2, in addition, the original use of npm 6.x install is no problem, because npm 7.x on peer dependency compatibility requirements are higher, so the error is reported.

2. Solution:

Method 1: — force or — legacy peer DEPs

npm install –force

npm   install –legacy-peer-deps

Method 2:

Modify the dependency definition package.json of the problem component and the component version that peer dependency depends on.

[Solved] NPM install Error: check python checking for Python executable python2 in the PATH

Scenario: after upgrading the node environment, an error is reported when the project version number does not match. After deciding to reinitialize, an error is reported again

Building: G:\nodejs\node.exe F:\test\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'G:\\nodejs\\node.exe',
gyp verb cli   'F:\\test\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (F:\test\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (F:\test\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (F:\test\node_modules\which\which.js:80:29)
gyp verb `which` failed     at F:\test\node_modules\which\which.js:89:16
gyp verb `which` failed     at F:\test\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at F:\test\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (F:\test\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (F:\test\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (F:\test\node_modules\which\which.js:80:29)
gyp verb `which` failed     at F:\test\node_modules\which\which.js:89:16
gyp verb `which` failed     at F:\test\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at F:\test\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21) {
gyp verb `which` failed   stack: 'Error: not found: python2\n' +
gyp verb `which` failed     '    at getNotFoundError (F:\\test\\node_modules\\which\\which.js:13:12)\n' +
gyp verb `which` failed     '    at F (F:\\test\\node_modules\\which\\which.js:68:19)\n' +
gyp verb `which` failed     '    at E (F:\\test\\node_modules\\which\\which.js:80:29)\n' +
gyp verb `which` failed     '    at F:\\test\\node_modules\\which\\which.js:89:16\n' +
gyp verb `which` failed     '    at F:\\test\\node_modules\\isexe\\index.js:42:5\n' +
gyp verb `which` failed     '    at F:\\test\\node_modules\\isexe\\windows.js:36:5\n' +
gyp verb `which` failed     '    at FSReqCallback.oncomplete (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python G:\Python\Python37-32\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: G:\Python\Python37-32\python.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];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:295:12)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "G:\\nodejs\\node.exe" "F:\\test\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsas
s_library="
gyp ERR! cwd F:\test\node_modules\node-sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-11-18T07_33_10_767Z-debug.log

Process finished with exit code 1

The solution for online search is:

npm install --global windows-build-tools --save

But it got stuck when installing windows build tools, so the solution is as follows

1, run npm install -g windows-build-tools
2, in the %temp% folder, find the latest file with a filename similar to dd_installer_20210421124746.log
3, check this file, make sure the log output Closing the installer with exit code 0
4, make sure you have vscode installed
PS: In fact, you can skip steps 2-4, because your python environment has already been installed, and the repeated steps of the installer have already been executed.
5, create a file named dd_client_.log in the %temp% directory
6, edit the file created in 5, add a line Closing installer. return code: 3010. and save it.
Note: Paste %temp% directly in Explorer to open your Windows temp directory.

Finally, NPM install is installed successfully

[Solved] This usually happens because your environment has changed since running `npm install`

The root of the problem: This is usually because the environment has changed after running the NPM installation.
Run “NPM Rebuild Node SASS-Mandatory” to build bindings for the current environment.

How to solve: Run at this time and follow the prompts to execute the npm rebuild node-sass command

(If it doesn’t work, run the npm install node-sass command first)

Then run the node command to start the service

NPM Install Error: npm ERR! ERESOLVE unable to resolve dependency tree

PS F:\devops_common\cloud-vue> npm cache   cache sudo npm cache clean -f
npm WARN using –force Recommended protections disabled.
npm ERR! code EUSAGE
npm ERR! npm cache
npm ERR!
npm ERR! Manipulates packages cache
npm ERR!
npm ERR! Usage:
npm ERR! npm cache add <folder>
npm ERR! npm cache add <tarball url>
npm ERR! npm cache add <git url>
npm ERR! npm cache add <name>@<version>
npm ERR! npm cache clean
npm ERR! npm cache verify
npm ERR!
npm ERR! Run “npm help cache” for more info
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mr\AppData\Local\npm-cache\_logs\2021-05-01T03_13_10_382Z-debug.log
PS F:\devops_common\cloud-vue> npm cache
npm ERR! code EUSAGE
npm ERR! npm cache
npm ERR!
npm ERR! Manipulates packages cache
npm ERR!
npm ERR! Usage:
npm ERR! npm cache add <folder>
npm ERR! npm cache add <name>@<version>
npm ERR! npm cache clean
npm ERR! npm cache verify
npm ERR!
npm ERR! Run “npm help cache” for more info
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mr\AppData\Local\npm-cache\_logs\2021-05-01T03_13_18_530Z-debug.log
PS F:\devops_common\cloud-vue> npm cache clean -f
npm WARN using –force Recommended protections disabled.
PS F:\devops_common\cloud-vue>
PS F:\devops_common\cloud-vue> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/less
npm ERR!   less@”^2.7.3″ from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer less@”^3.5.0 || ^4.0.0″ from [email protected]
npm ERR!   less-loader@”^7.3.0″ from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with –force, or –legacy-peer-deps
npm ERR!
npm ERR! See C:\Users\Mr\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mr\AppData\Local\npm-cache\_logs\2021-05-01T03_14_21_801Z-debug.log
PS F:\devops_common\cloud-vue> ^C
PS F:\devops_common\cloud-vue> npm install [email protected] -g
added 2 packages, removed 236 packages, changed 3 packages, and audited 54 packages in 14s
found 0 vulnerabilities
PS F:\devops_common\cloud-vue> npm installProblem Analysis: npm version is too high
Problem solved.
npm install [email protected] -g

Module not found: Error: Can’t resolve ‘sass-loader’ in ‘F:\H5\project-h5’

Module not found: Error: Can’t resolve ‘sass-loader’ in ‘F:\H5\project-h5’

The error is more straightforward. Without the SASS-Loader, we just need to install the specified plug-in as required.

npm install sass-loader -D
npm install node-sass -D



The second installation will take a little longer, so be patient.
Meng New exclusive extension: -d =& GT; — Save-dev, and another -s => – save.
If the two plug-ins installed after the following error ↓

This may be a compilation error due to a high version of the SASS-Loader

npm uninstall sass-loader(Uninstall current version) 
npm install [email protected] --save-dev

Recompiling is successful

npm install Error: stack Error: Can’t find Python executable “python”

NPM install Error: stack Error: Can’t find Python “Python” executable
Because of the need for node-gyp installation, it can only support python2, the official recommendation is python2.7, the download link
after the installation is complete, set the environment variable PYTHONPATH (value is the installation directory, such as C:\Python27) and PYTHON (value is %PYTHONPATH%\python.exe)
and then set it in the terminal: NPM config set python “C:\Python27\python.exe”
problem solved