Tag Archives: Npm

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 eslint-plugin-jsdoc@latest --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

Vue Use scss Error: this.getOptions is not a function [How to Solve]

Background: an error is reported when installing sass for NPM

Installing sass through NPM

npm install node-sass
npm intall sass-loader

The above command installs the latest version. The reason for the error is that the latest version causes getoptions() incompatibility. The solution is to uninstall sass loader node sass and install the lower version. The commands are as follows

npm uninstall sass-loader //uninstall
npm install [email protected]  //install 8.0
npm uninstall --save node-sass
npm install [email protected] 

Webpack multi version incompatibility error

NPM run build packaging source code is incompatible with multiple versions of webpack, and an error is reported

Then use NPM run build to package the source code, and there is a webpack error, and then the prompt message of NPM audit fix is as follows

su@ly050:~/Downloads/dingtalk$ npm audit fix
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"4.x.x || 5.x.x" from @webpack-cli/[email protected]
npm ERR!   node_modules/@webpack-cli/configtest
npm ERR!     @webpack-cli/configtest@"^1.1.0" from [email protected]
npm ERR!     node_modules/webpack-cli
npm ERR!       dev webpack-cli@"^4.9.1" from the root project
npm ERR!       3 more (@webpack-cli/configtest, @webpack-cli/info, @webpack-cli/serve)
npm ERR!   peer webpack@">=2" from [email protected]
npm ERR!   node_modules/babel-loader
npm ERR!     dev babel-loader@"^8.1.0" from the root project
npm ERR!   13 more (clean-webpack-plugin, eslint-loader, file-loader, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.27.0 || ^5.0.0" from [email protected]
npm ERR! node_modules/css-loader
npm ERR!   dev css-loader@"^4.2.1" from the root project
npm ERR!   peer css-loader@"*" from [email protected]
npm ERR!   node_modules/vue-loader
npm ERR!     dev vue-loader@"^15.9.3" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.27.0 || ^5.0.0" from [email protected]
npm ERR!   node_modules/css-loader
npm ERR!     dev css-loader@"^4.2.1" from the root project
npm ERR!     peer css-loader@"*" from [email protected]
npm ERR!     node_modules/vue-loader
npm ERR!       dev vue-loader@"^15.9.3" 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 /home/su/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/su/.npm/_logs/2021-11-01T01_35_04_547Z-debug.log

My approach is to uninstall the current webpack and then reassign a global version.

sudo npm uninstall webpack
sudo npm install [email protected] -g

[Solved] Vue create error: ERROR: command failed: npm install –loglevel error

Vue create reports an error

Solution: https://stackoverflow.com/questions/53934852/vue-cli-3-command-failed-npm-install-loglevel-error

It should be noted that the article provides two main solutions:
1. NPM cache clean -- force or manually delete the NPM cache in the appdata folder
2.npm config set registry=" http://registry.npmjs.org/" after running this command, you can create your own project.

After I tried the first scheme unsuccessfully, I tried to combine the two schemes successfully, but I don’t know the specific principle. I hope someone with good intentions can help me solve what’s wrong

npm ERR Error: EPERM:operation not permitted, rename

npm ERR! Error: EPERM: operation not permitted, rename

Problem background: Recently, there was a problem with the packaging of the project. I thought it was caused by the node version problem, so I tossed and switched several versions, which led to the problem of NPM

    when NPM is installed, the following error is reported (the picture refers to someone else’s, infringed or deleted). There are many reasons for this error. The specific reason is that the node version and windows version are intertwined, which makes it impossible to find out exactly (I hope some big guys can find it)
    in addition, the time when this problem occurs is also different, some are during installation, Some are during run dev, and some are during packaging.
    after encountering problems, the first is a variety of search solutions. The commonly used solutions are probably the following:

    Run CMD as administrator

    Because the system prompts that the permission is not enough, I am now an ordinary user. Then I run as an administrator. The idea is feasible
    see: https://blog.csdn.net/Running_ Fe/article/details/81629330

    Delete the. Npmrc file in the user directory

    This scheme can solve some problems to a certain extent

    Clear cache + reinstall: NPM clear cache — force, NPM install

    see: https://www.cnblogs.com/maycpou/p/12080814.html

    Delete the file mentioned in the error message

    Some people say that this solution can solve the problem, but I can’t find the file
    see: https://blog.csdn.net/LJJONESEED/article/details/119926728

    Close all editors that reference the current project

    Because his error message says “the current file may be open in another editor”, close the editor, clear the cache, and then reload

    Finally, a post in stack overflow is attached. The discussion below this post is very intense. There are many schemes. If you are interested, you can look

    see: https://stackoverflow.com/questions/39293636/npm-err-error-eperm-operation-not-permitted-rename#

    Please note that
    I hope some big guys can give the real reason for this problem and hold their fists

Syntax Error: Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.

Problem: version correspondence
solution:

    uninstall node sass

    npm uninstall node-sass
    
      install version 4.14.1

      npm install [email protected]
      
        network problems may occur during installation. Taobao image can be used. It is recommended to use the following methods. It is not recommended to permanently use Taobao image
        single use

        npm install --registry=https://registry.npm.taobao.org
        
          if you still cannot install, you can find the corresponding version number in the package.json file and modify it directly. The version number I use here is
          node sass: 4.14.1
          sass loader: 7.1.3
          generally, the idea will remind the update dependency in the lower right corner, otherwise the node will be deleted directly_ Download the modules folder again

          Reference link 1
          reference link 2

[Solved] Vue item packaging error: Failed to load resource: the server responded with a status of 404 (Not Found)

After NPM run build is executed, a dist folder will be generated, index.html will be opened, and an error will be reported on the console

As shown in the figure below:

This is because the correct path cannot be found, resulting in an error.

Solution:

1. In the root directory, create a new vue.config.js file. Of course, if any, ignore this item;

2. In vue.config.js, change publicpath: “/” to   Publicpath: “. /”, then repackage and NPM run build.

publicPath: “/”          =====>>>>>>>>       publicPath: “./”

For the location of writing, you can refer to the following code:

module.exports = {
  devServer: {
    port: 8080,
    open: true
  },
  lintOnSave: false,
  publicPath: "./",
  outputDir: "dist",
  assetsDir: "static",//Set the directory where the static resources (js, css, img, fonts) generated by the package will be placed.
  indexPath: 'index.html'//Used to set the storage location of the index.html file generated by the package
}

Vue installs sass loader directly, and node sass reports an error

Vue installs sass loader directly, and node-sass reports an error

An error will be reported when using NPM I sass loader node sass - d to install directly. This is because the version of SASS loader is too high. Please install sass loader version 7.3.1

If you also need to customize the theme color, you happen to add a file named element variables.SCSS directly under SRC instead of using the command. Then you will encounter the incompatibility of node-sass versions later. On October 28, 2021, I installed version 6.0.1 here. At this time, I can change it to version 4.14.1