Tag Archives: Npm

Solve the problem of 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  

ERROR command failed: npm install –loglevel error vue-cli-plugin-cube-ui -D

Execute the command at the vscode terminal: Vue add cube UI reports an error   Command failed: NPM install — loglevel error Vue cli plugin cube UI – d the solution is as follows:

Exit vscode – & gt; Right click the visual studio code icon – & gt; Click Properties – & gt; Click compatibility – & gt; Check the “run this program as administrator” option – & gt; Click OK

 

How to Solve Error: spawn xxxx ENOENT

Error explanation:   This error indicates that no such directory exists, which generally means that the global variable of command XXX is not set
The full name of enoent is error no entry, and there is no error in the entity directory;

Example: scaffold occurs when NPM installation directory is used, and spawn git enoent error occurs

Solution: it means that Git is not installed or the GIT environment variable is not set. Add “C:\program files\git\bin” in the path of the environment variable. The path is adjusted according to your git installation directory

Failed to load plugin jsdoc: Cannot find module ‘eslint-plugin-jsdoc‘

In the egg project, NPM is installed for the first time   The following errors are reported when the package is:

Oops! Something went wrong! :(

ESLint: 5.16.0.
ESLint couldn't find the plugin "eslint-plugin-jsdoc". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-jsdoc is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

     npm i [email protected] --save-dev

Path to ESLint package: /Users/***/node_modules/eslint

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

The eslint does not work normally, and when the file does not comply with the eslint rules, an error is reported in the console log as follows:

Failed to load plugin jsdoc: Cannot find module 'eslint-plugin-jsdoc'....

reason:

When NPM v8.0 installed the project dependency, it did not correctly install the project dependency (eslint config egg) dependency (eslint plugin JSDoc)

solve:

After upgrading NPM to v8.1.2, delete the node in the project_ Modules and package-lock.json, and then reinstall

rm -rf node_modules
rm package-lock.json
npm i

Supplement:

If you have the same error, you can search globally   Eslint plugin JSDoc to locate dependencies with NPM command

➜  *** git:(master) ✗ npm ls eslint-plugin-jsdoc
***@1.0.0 /Users/***
└─┬ [email protected]
  └── [email protected]

Then determine whether to install or upgrade NPM manually or for other reasons.

[Solved] NPM err! Cannot read property ‘parent’ of null npm ERR! A complete log of this run can be found in: npm ERR!

Error reporting: NPM err! Cannot read property ‘parent’ of null npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Aren\AppData\Local\npm-cache_logs\2021-04-06T02_00_29_654z-debug.log
reason: in the project dependency package, the node-sass module requires node-gyp
and node-gyp; It also needs to rely on Python 2.7 and Microsoft’s VC + + build tools for compilation, but Windows operating system will not install Python 2.7 and VC + + build tools by default

Solution:
1. Use the administrator to open CMD

2. Install node-gyp
command

npm install -g node-gyp

3. Configure and install python2.7 and VC + + build tools
because node-gyp needs to rely on python2.7 and Microsoft’s VC + + build tools for compilation, but Windows operating system will not install python2.7 and VC + + build tools by default

Install python2.7 and VC + + build tools dependencies for node-gyp configuration:

npm install --global --production windows-build-tools

4. Check whether the installation is successful and restart NPM install