Tag Archives: node.js

[Solved] Syntax Error: Error: Node Sass does not yet support your current environment: Windows 64-bit with

Syntax error: error: node sass does not yet support your current environment: Windows 64 bit with unsupported runtime (93)

Detailed error reporting is shown in the figure:

reason:

Node-sass does not support high versions of node.
my version is 16.14.2

and the node-sass version supports as shown in the figure:

windows only supports 14 versions at most.

Solution:

    1. reinstall node version 14.
    1. Use NVM for node version management and change the node version to 14.

effect

As shown in the figure, after changing to version 14.19.1, it starts normally

[Solved] npm Install vuex Error: npm ERR! code ERESOLVE

Question

The following error is reported when NPM install vuex — save is used on the command line

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/vue
npm ERR!   vue@"^2.5.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.0.2" from [email protected]
npm ERR! node_modules/vuex
npm ERR!   vuex@"*" 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! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See C:\Users\admin\AppData\Local\npm-cache\eresolve-report.txt for a full repor
t.

This problem occurs because the version of NPM is too high

Solution:

Install the specified version of vuex
view the installable version of vuex

C:\Users\admin>npm view vuex versions --json
[
  "0.1.0",
  "0.2.0",
  "0.3.0",
  "0.4.0",
  "0.4.1",
  "0.4.2",
  "0.5.0",
  "0.5.1",
  "0.6.1",
  "0.6.2",
  "0.6.3",
  "0.7.0",
  "0.7.1",
  "0.8.0",
  "0.8.1",
  "0.8.2",
  "1.0.0-rc",
  "1.0.0-rc.2",
  "1.0.0",
  "1.0.1",
  "2.0.0-rc.1",
  "2.0.0-rc.3",
  "2.0.0-rc.4",
  "2.0.0-rc.5",
  "2.0.0-rc.6",
  "2.0.0",
  "2.1.0",
  "2.1.1",
  "2.1.2",
  "2.1.3",
  "2.2.0",
  "2.2.1",
  "2.3.0",
  "2.3.1",
  "2.4.0",
  "2.4.1",
  "2.5.0",
  "3.0.0",
  "3.0.1",
  "3.1.0",
  "3.1.1",
  "3.1.2",
  "3.1.3",
  "3.2.0",
  "3.3.0",
  "3.4.0",
  "3.5.0",
  "3.5.1",
  "3.6.0",
  "3.6.1",
  "3.6.2",
  "4.0.0-alpha.1",
  "4.0.0-beta.1",
  "4.0.0-beta.2",
  "4.0.0-beta.3",
  "4.0.0-beta.4",
  "4.0.0-rc.1",
  "4.0.0-rc.2",
  "4.0.0",
  "4.0.1",
  "4.0.2"
]

Install the specified version of vuex

npm install [email protected] --save

[Solved] Error Rule can only have one resource source (provided resource and test + include + exclude)

Error: Rule can only have one resource source
(provided resource and test + include + exclude)

Error: Rule can only have one resource source (provided resource and test + include + exclude)

Error: Rule can only have one resource source (provided resource and test + include + exclude) in
 "exclude": [
    null
  ],
  "use": [
    {
      "loader": "/Users/juanpablo/front-treatments/node_modules/cache-loader/dist/cjs.js",
      "options": {
        "cacheDirectory": "/Users/juanpablo/front-treatments/node_modules/.cache/babel-loader",
        "cacheIdentifier": "81fef5a6"
      },
      "ident": "clonedRuleSet-38[0].rules[0].use[0]"
    },
    {
      "loader": "/Users/juanpablo/front-treatments/node_modules/babel-loader/lib/index.js",
      "options": "undefined",
      "ident": "undefined"
    }
  ]
} ````
A complete log of this run can be found in:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/node',
1 verbose cli   '/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'serve'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle [email protected]~preserve: [email protected]
6 info lifecycle [email protected]~serve: [email protected]
7 verbose lifecycle [email protected]~serve: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~serve: PATH: /Users/juanpablo/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/juanpablo/front-treatments/node_modules/.bin:/Users/juanpablo/.nvm/versions/node/v12.19.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/juanpablo/.rvm/bin
9 verbose lifecycle [email protected]~serve: CWD: /Users/juanpablo/front-treatments
10 silly lifecycle [email protected]~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 silly lifecycle [email protected]~serve: Returned: code: 1  signal: null
12 info lifecycle [email protected]~serve: Failed to exec serve script
13 verbose stack Error: [email protected] serve: `vue-cli-service serve`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/juanpablo/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/Users/juanpablo/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/juanpablo/front-treatments
16 verbose Darwin 19.6.0
17 verbose argv "/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/node" "/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/npm" "run" "serve"
18 verbose node v12.19.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] serve: `vue-cli-service serve`
22 error Exit status 1
23 error Failed at the [email protected] serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Cause analysis:

Webpack version conflict in package.json.


Solution:

Delete the webpack and reinstall the previous version
npm uninstall webpack
npm install webpack@^4.0.0 –save-dev

[Solved] NPM Start Project Error: ‘Error: error:0308010C:digital envelope routines::unsupported’

Reason: the version of node is higher than 16, the version of the project is not higher than 16, and OpenSSL is updated after node17.

Solution:

Method 1:

Modify the environment variable at the command line: $env:NODE_OPTIONS="--openssl-legacy-provider"
In the start project: yarn start
Method 2.
Use nvm to modify the node to a version no higher than 16

[Solved] Node.js: Error: connect ECONNREFUSED ::1:3306

Use node JS database module MySQL , connection database query error

Error: connect ECONNREFUSED ::1:3306

reason

I annotated the mapping relationship of /ECT/hosts

# 127.0.0.1   localhost

The original configuration used localhost , so the database could not be connected suddenly

{
  host: 'localhost',
  user: 'root',
  password: '123456',
  database: 'data',
};

Treatment method

Method 1:

Change the mapping relationship of /ECT/hosts

# 127.0.0.1   localhost
127.0.0.1   localhost

Method 2:

You can use 127.0.0.1 instead

{
  // host: 'localhost',
  host: '127.0.0.1',
  user: 'root',
  password: '123456',
  database: 'data',
};

[Solved] MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe“

MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe”.

This problem occurs in the install front-end project

MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe”…

Solution:

1. The administrator opens CMD and sets the agent (optional, if you have one)

set HTTP_PROXY=http://127.0.0.1:1080
set HTTPS_PROXY=http://127.0.0.1:1080

2. Install windows build tool

npm install -g --production windows-build-tools

3. If the card is completely stuck, wait for one minute, and then enter C:\Users\Username\.windows-build-tools

If there is a file in the figure below, the download is successful, and if there is no file, the download fails

If the download fails, download it manually and extract it to C:\Users\Username\

The final status is shown in the figure:

5 Configure system environment variables (Setting -> advanced system settings -> environment variables)

Append to path item

​ C:\Users\13261.windows-build-tools

​ C:\Users\13261.windows-build-tools\python27

6. change the file name

Because the problem I encountered was MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe”…

The project will use the executable file VCBuild.exe to build

So I made a copy of vs_BuildTools.exe and modified it to VCBuild.exe, so that cmd can use “VCBuild”!

Because I have already installed python3 or higher, the command is also “python”

so python2.7 I will also modify the executable to python.exe -> python2.exe, pythonw.exe -> python2w.exe

TIP: If your front-end project will be built with commands like “python2” or “python3” instead of “python” to execute python code, then you also need to rename the executable

Translated with www.DeepL.com/Translator (free version)

[Solved] npm Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.

1. NPM error reporting

npm ERR! code 1
npm ERR! path D:\Workspaces\WebstormProjects\shop-ui\buyer\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (D:\Workspaces\WebstormProjects\shop-ui\buyer\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (D:\Workspaces\WebstormProjects\shop-ui\buyer\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack     at callback (D:\Workspaces\WebstormProjects\shop-ui\buyer\node_modules\graceful-fs\polyfills.js:299:20)
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\Workspaces\\WebstormProjects\\shop-ui\\buyer\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\Workspaces\WebstormProjects\shop-ui\buyer\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Program Files\nodejs\node_cache\_logs\2022-01-28T09_54_16_535Z-debug.log

2. Solution
npm install --global --production windows-build-tools

Error: Cannot find module ‘./application‘ [How to Solve]

1. Background:

Run in PowerShell: PS e: \ vscode \ Vue \ day4 \ code \ myapi & gt; nodemon . \index. JS
error reporting

2. Error reporting content:

PS E:\vscode\vue\day4\code\myapi> node .\index.js
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './application'
Require stack:
- E:\vscode\vue\day4\code\myapi\node_modules\express\lib\express.js
- E:\vscode\vue\day4\code\myapi\node_modules\express\index.js
- E:\vscode\vue\day4\code\myapi\index.js
[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)[39m
[90m    at Function.Module._load (node:internal/modules/cjs/loader:778:27)[39m
[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)[39m
[90m    at require (node:internal/modules/cjs/helpers:102:18)[39m
    at Object.<anonymous> (E:\vscode\vue\day4\code\myapi\node_modules\[4mexpress[24m\lib\express.js:18:13)
[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)[39m
[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)[39m
[90m    at Module.load (node:internal/modules/cjs/loader:981:32)[39m
[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)[39m
[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)[39m {
  code: [32m'MODULE_NOT_FOUND'[39m,
  requireStack: [
    [32m'E:\\vscode\\vue\\day4\\code\\myapi\\node_modules\\express\\lib\\express.js'[39m,
    [32m'E:\\vscode\\vue\\day4\\code\\myapi\\node_modules\\express\\index.js'[39m,
    [32m'E:\\vscode\\vue\\day4\\code\\myapi\\index.js'[39m
  ]
}

3. Solution:

1. Prompt for finding the error point: error: cannot find module ‘/ application’
2. According to the error prompt, baidu solved the first blog

4. Causes:

Execute node \index. JS, PowerShell did not find ‘/ Application ‘this module should be index JS file runtime calls
node_ The dependent module in the modules folder is not found, so an error is reported

5. Solution:

1. Delete node_Modules folder (because dependencies are placed here)
2 There is a package Run in the folder of JSON file: PS e:\vscode\Vue\day4\code\myapi > npm install
3. The previous step is based on package JSON file re download dependency

[Solved] NRM Error: error code: ‘err’_INVALID_ARG_Type ‘

Commandnpm install nrm -g to install nrm 1.2.1 error:

[TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
  at validateString (internal/validators.js:122:11)
  at Object.join (path.js:375:7)
  at Object.<anonymous> (C:\Users\liyin\AppData\Roaming\npm\node_modules\nrm\cli.js:17:20)
  at Module._compile (internal/modules/cjs/loader.js:1076:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
  at Module.load (internal/modules/cjs/loader.js:941:32)
  at Function.Module._load (internal/modules/cjs/loader.js:782:14)
  at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
  at internal/main/run_main_module.js:17:47

] {
  code: 'ERR_INVALID_ARG_TYPE'
}

Locate the NRM directory (error line 4)

Open cli.js line 17 is modified to

//const NRMRC = path.join(process.env.HOME, '.nrmrc'); (DELETE)
const NRMRC = path.join(process.env[(process.platform == 'win32') ?'USERPROFILE' : 'HOME'], '.nrmrc');

After saving, reopen the command line to run the NRM LS command normally

C:\Windows\system32>nrm ls
  npm -------- [https://registry.npmjs.org/](https://registry.npmjs.org/)
  yarn ------- [https://registry.yarnpkg.com/](https://registry.yarnpkg.com/)
  cnpm ------- [http://r.cnpmjs.org/](http://r.cnpmjs.org/)
- taobao ----- [https://registry.npm.taobao.org/](https://registry.npm.taobao.org/)
  nj --------- [https://registry.nodejitsu.com/](https://registry.nodejitsu.com/)
  npmMirror -- [https://skimdb.npmjs.com/registry/](https://skimdb.npmjs.com/registry/)
  edunpm ----- [http://registry.enpmjs.org/](http://registry.enpmjs.org/)
  [TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:122:11)
    at Object.join (path.js:375:7)
    at Object.<anonymous> (C:\Users\liyin\AppData\Roaming\npm\node_modules\nrm\cli.js:17:20)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:782:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
  ] {
    code: 'ERR_INVALID_ARG_TYPE'
  }

[Solved] npm link Error: error Error: EPERM: operation not permitted;The operation was rejected by your operating

Error message:

Solution:

From the error message, the prompt is that the permission is insufficient to operate. All the files found on the Internet are to delete npmrc files, but there is no effect. Through exploration, we can solve it in two ways:
1. Run vscode as an administrator, and then run NPM link on the vscode terminal
2. Run CMD (command prompt) as an administrator, Go into your own module and run NPM link

it’s done

[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