After installing node in Windows 10, node – V, NPM – V and cnpm – V are tested to be normal. Cnpm install – G @Vue/cli reports an error
error: eperm: operation not allowed, MKDIR'd:\nodejs\node_global\node_Modules\@Vue'
I found a lot of methods, but I found that the permission was insufficient, so I had a solution
click the attribute in the directory where node is installed to find the security
it’s ok to allow the setting completely
Tag Archives: Npm
[Solved] NPM node ERROR in main..js from Terser ChildProcessWorker.initialize Excaption
Error message
ERROR in main.c3605.js from Terser
Error: Call retries were exceeded
at ChildProcessWorker.initialize (/home/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)
at ChildProcessWorker._onExit (/home/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/workers/ChildProcessWorker.js:274:12)
at ChildProcess.emit (events.js:315:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
How to Find the Solution:
Since 2.3.0, webpack builds on CircleCI fail with “Error: Call retries were exceeded”
View operating system logs
less /var/log/messages
Solution
Increase server memory and reduce Max specified in the build command_old_space_Size
value
Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘
Question:
implement NPX create react app XXX reports an error
PS D:\Desktop>npx create-react-app demo
Error: EPERM: operation not permitted, mkdir 'D:\nodejs\node_modules\npm\node_cache\_npx'
TypeError: Cannot read property 'get' of undefined
at errorHandler (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\utils\error-handler.js:213:18)
at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\bin\npm-cli.js:83:20
at cb (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\npm.js:215:22)
at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\npm.js:253:24
at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\config\core.js:81:7
at Array.forEach (<anonymous>)
at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\config\core.js:80:13
at f (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\config\core.js:178:20)
at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\node_modules\mkdirp\index.js:35:29
D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\utils\error-handler.js:213
if (npm.config.get('json')) {
^
TypeError: Cannot read property 'get' of undefined
at process.errorHandler (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\utils\error-handler.js:213:18)
at process.emit (events.js:400:28)
at process._fatalException (internal/process/execution.js:167:25)
Install for [ 'create-react-app@latest' ] failed with code 7
terms of settlement:
Create react- app@latest Install to global
npm install create-react-app@latest -g
Run after installation
npx create-react-app demo
So you can write the project
Vue cli 4 CMD command creates an error: error command failed NPM install – loglevel error – solution
Vue cli 4 CMD command creates an error: error command failed NPM install – loglevel error – solution
Solution: on the CMD command line, enter NPM cache clean — force
Vue project startup error: cannot find module XXX
Cause: a module that the project depends on cannot be found
Solution:
1. delete the folder where
modules are stored node_ module
;
2. Execute the clear cache
command NPM cache clean
If an error is reported, use to force
to clear NPM cache clean -- force
If an error is reported, delete the package-lock.json
file;
3. Reinstall the module, NPM install
; (the package-lock.json file will be automatically regenerated)
Then restart NPM run dev.
Front end project runtime prompts syntax error: typeerror: token.type.endswith is not a function solution
Reference documents:
https://www.baidu.com/link?url=rxkuHBNVNB0i7GCoDEfgkwDr3AllV9XWRLWwkFQl7p1PjamwyIPupL93spZDTywmxMetZ7yHNtqtgJRPGR0POa& ; wd=& eqid=d1c30348003392a90000000461721b6e
Problem background:
After pulling a branch for the project code, execute NPM install to download the dependent package, and then execute NPM run serve to find that the project fails to run. The prompt message is syntax error: typeerror: token.type.endswith is not a function.
Solution:
The author’s version of Babel eslint is 10.1.0, and the version is reduced to 8.2.2. The project is run again and runs successfully.
remarks:
The reason for the error seen on GitHub is that the version of Babel eslint is wrong, and the version reduction can indeed solve this problem. However, it is strange that the Babel eslint version of the author’s trunk is the same as that of the branch, both of which are 10.1.0, while the trunk project can run successfully, but the branch project can’t.
[Solved] Npm install Error: verbose stack Error: unable to resolve dependency tree
[environment]
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.
Module build failed: Error: Node Sass version 6.0.0 is incompatible with ^4.0.0
When executing the named NPM run dev to start the front-end project, the following error is reported
Module build failed: Error: Node Sass version 6.0.0 is incompatible with ^4.0.0.
From the prompt, I downloaded the latest dependency. The current version is incompatible. Later, I checked the relevant documents, which is really caused by the high version;
The simple way is to find the appropriate version and install the specified version (try it several times if you don’t know the version)
The processing steps are as follows:
#uninstall
npm uninstall node-sass
#install with the version
npm install [email protected] --save-dev
Run NPM run dev again
How to Solve DVA switches history to browserhistory Error
report errors:
Module not found: Can't resolve 'history/createBrowserHistory'
Solution:
// import createHistory from 'history/createBrowserHistory';
// Error: Cannot find module 'history/createBrowserHistory';
// Change to
import { createBrowserHistory as createHistory} from 'history';
const app = dva({
history: createHistory(),
});
[Solved] Npm -v Error: Cannot find module npm_cli
1. If you download the upgraded node version from the node official website, the package management NPM will be automatically installed
2. If you install the NVM and then upgrade or downgrade the node version, the NPM is not automatically installed at this time As shown in the figure, my node 12.10.0 is downloaded from the official website and 10.15.3 is managed by NVM. After switching back, the NPM will not report an error
How to Solve Node GYP Rebuild Error
Node gyp rebuild error handling
Error message:
node-gyp rebuild
CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc:50:53: error: too few arguments to function call, single argument 'context' was not specified
target->Set(className, ljsTmpl->GetFunction());
~~~~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:6482:46: note: 'GetFunction' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^
../src/contextify.cc:60:74: error: too few arguments to function call, single argument 'context' was not specified
ContextifyContext* ctx = new ContextifyContext(info[0]->ToObject());
~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2822:44: note: 'ToObject' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
^
../src/contextify.cc:75:48: error: too few arguments to function call, single argument 'context' was not specified
Local<String> code = info[0]->ToString();
~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2810:44: note: 'ToString' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
^
../src/contextify.cc:81:51: error: too few arguments to function call, single argument 'context' was not specified
ScriptOrigin origin(info[1]->ToString());
~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2810:44: note: 'ToString' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
^
../src/contextify.cc:124:45: error: too few arguments to function call, single argument 'context' was not specified
constructor.Reset(tmpl->GetFunction());
Solution: switch the node version to node 8.17.0 to solve the above error reports
Mac install to multi version node
1. Download and install
NPM install -g n
2. Download the specified version (followed by the version number)
sudo n 14.15.0
3. Display which versions have been installed
n LS
4. Switch the version used (followed by the version number)
sudo n
view the installed version and switch the version used up and down
[Solved] Syntax Error: TypeError: this.getOptions is not a function
Syntax Error: TypeError: this.getOptions is not a function
Scenario:
Error reporting when running Vue project
Error message:
Syntax Error: TypeError: this.getOptions is not a function
@ ./node_modules/vue-style-loader??ref--8-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/article/article.vue?vue&type=style&index=0&id=53e7acee&lang=scss&scoped=true& 4:14-480 15:3-20:5 16:22-488
@ ./src/pages/article/article.vue?vue&type=style&index=0&id=53e7acee&lang=scss&scoped=true&
@ ./src/pages/article/article.vue
@ ./src/router/config.js
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.3.101:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js babel-polyfill whatwg-fetch ./src/main.js
reason:
The probability is that the installed version of SCSS loader is too high
Solution:
uninstall the original too high version and install the lower version
npm uninstall --save sass-loader // uninstall
npm i -D [email protected] // install
npm uninstall --save node-sass //uninstall
npm i [email protected] // install