Tag Archives: Npm

(node:268660) UnhandledPromiseRejectionWarning: Error: Cannot find module ‘yallist‘

NPM command error in vscode

In Vue (node: 268660) unhandledpromiserejectionwarning: error: cannot find module ‘yallist’ problem solving delete the under C: \ users \ [current user name] Npmrc file Npmrc file content:

In Vue (node: 268660), unhandledpromiserejectionwarning: error: cannot find module ‘yallist’ problem solving

Delete the under C: \ users [current user name] Npmrc file

. Npmrc file content:

cache=C:\Software\Tool\nodejs\node_cache
prefix=C:\Software\Tool\nodejs\node_global
registry=https://registry.npm.taobao.org

Using ts-node to Execute .ts files Error [Solved]

When learning typescript, you want to execute the TS file. First install the TS package, then use the TSC command to execute it, compile it into a JS file, and use node xxx.js to execute it. However, this is troublesome. Later, you want to use TS node to directly execute it and simplify the steps. An error is reported:

It is found that the corresponding package needs to be installed to compile:

Solution:
 
npm install -D tslib @types/node

Vue Error: renren-fast-vue execute npm install Error [How to Solve]

Resolution NPM: unable to load file D:\code\Renren fast Vue\node_ modules.bin\npm.ps1

There are four steps

It is forbidden to run scripts on this system, that is, you do not have permission. First use the following command:

get-ExecutionPolicy

If output:

Restricted

The above indicates restricted and the status is prohibited. Then give a permission:

Set-ExecutionPolicy -Scope CurrentUser

Re enter:

RemoteSigned

The above is OK. If you want to verify it, enter get executionpolicy and output remotesigned

==================================================================

Build failed with error code: 1
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! [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\2021-12-03T02_48_23_436Z-debug.log
PS D:\work\guigu\guli-vue\renren-fast-vue> get-ExecutionPolicy
Restricted
PS D:\work\guigu\guli-vue\renren-fast-vue> Set-ExecutionPolicy -Scope CurrentUser

cmdlet Set-ExecutionPolicy in command pipeline location 1
Please provide values for the following parameters:
ExecutionPolicy: RemoteSigned
PS D:\work\guigu\guli-vue\renren-fast-vue> get-ExecutionPolicy
RemoteSigned
PS D:\work\guigu\guli-vue\renren-fast-vue> npm install

How to Solve MAC electronic installation dependent startup error

file: https://github.com/electron/electron/issues/8466

Error message:

Solution:

Switch to node_ The index file used for the electron pair in modules, then enter the terminal and execute it in the current directory with node install.js before completing the electron dependent installation

Then go to the project again and start the project

[Solved] Error: EPERM: operation not permitted (Permissions issue)

NPM download dependency error

npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'E:\\code\\20200212\\web\\cbos2.0-wenlv-wx-cli\\node_modules\\.staging\\caniuse-lite-70323fe6\\data\\features\\document-scrollingelement.js'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'E:\\code\\20200212\\web\\cbos2.0-wenlv-wx-cli\\node_modules\\.staging\\caniuse-lite-70323fe6\\data\\features\\document-scrollingelement.js',
npm ERR!   parent: 'cbos2.0-wenlv-wx-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\nodejs\node_cache\_logs\2021-11-25T08_55_03_606Z-debug.log

NPM installation has reported this all the time before, thinking that the permissions are really insufficient. I feel a little strange. It’s useless to execute with administrator permissions. However, I checked later and thought it was a cache problem. Just clean up the cache without administrator permissions. But it doesn’t work (see below)

Method 1

Npmrc files need to be deleted.

Stress: it is not the npmrc file under the NPM module in the nodejs installation directory, but the. Npmrc file under C: \ users {account} \. Delete the dependency and download it again

Method 2

Or you can clean it directly with the command. On the console, enter:

npm cache clean --force

I think it’s because I downloaded cnpm before, which leads to permission problems. In the future, the problem will be solved by installing the package with cmpn

nvm npm Error: segmentation fault [How to Solve]

Background

After NVM use switches the node version, NPM reports an error segmentation fault

My solution

sudo apt autoremove npm

Note: it must be autoremove, not remove. Remove is not completely cleared

Cause guess

There is a global NPM. The configuration of the global NPM affects the configuration of the NPM version corresponding to the node installed by the NVM

[Solved] NPM Error: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed

Problem Description:

Resolve NPM exception: fatal error: ineffective mark compacts near heap limit allocation failed

Solution:

1. Delete the. Npmrc file under C:\users {account}\.
2. Clean it directly with the command. Enter
NPM cache clean – force
3 on the CMD console, or clean it directly with the command. Enter cnpm install – G increase memory limit on the CMD console, and then increase memory limit

when running the Vue project, no error will be reported

[Solved] Syntax Error: Error: Cannot find module ‘cache-loader‘

The following problem occurs. It should be that some dependent packages are not downloaded successfully and need to be reinstalled

Solution:
1. Enter the folder directory of the project and delete the node_ Modules file and package-lock.json file. Note that it is not package.json (if it cannot be deleted, check whether the project is open and try again after closing)
2. Enter NPM install installation dependency

3. Start the project and it can be started normally.

[Solved] Vue calls style loader error: Module build failed: CssSyntaxError

Vue uses style loader to add CSS style to Dom and reports an error

ERROR in ./src/css/normal.css
Module build failed: CssSyntaxError

(1:1) Unknown word

> 1 | var content = require("!!./normal.css");
    | ^
  2 | 
  3 | if (typeof content === 'string') {

 @ ./src/main.js 11:0-27
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The loader sequence you configured in the webpack.config.js file may be wrong
original code

const path=require('path')
module.exports={
  entry: './src/main.js',
  output: {
    path:path.resolve(__dirname,'dist'),
    filename:'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ['css-loader','style-loader']
      },

    ]
  }
}

Code after modification

const path=require('path')
module.exports={
  entry: './src/main.js',
  output: {
    path:path.resolve(__dirname,'dist'),
    filename:'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ['style-loader','css-loader']
      },

    ]
  }
}

This is because when multiple loaders are configured, the program is read from right to left

ERROR Error: Cannot find module ‘../../uni-cli-sharedlib/tags‘

ERROR    Error:   Cannot   find   module  ‘../../ uni-cli-sharedlib/tags’

Recently, I ran the SVN project and reported an error. I tried many methods and various commands on the Internet

The last one found is that the NPM and node versions are incompatible

My node is 16.13.0

NPM is 8.13.1

The two versions are incompatible

The NPM version corresponding to node16.13.0 is 8.1.0

It can be solved by matching the version with this figure