introduction
Xiao Fang is a junior student. Today, he joined a front-end intern position in a company. He is so proud that he plans to do a big job. Results the card was stuck in NPM run build
, and the error message was reported (as follows).
$ npm run build
> [email protected] build /usr/local/docker/gitlab-ee-12.4.1/builds/63s9Rzjq/0/dev_web/system
> vue-cli-service build --mode production
- Building for production...
ERROR Failed to compile with 3 errors PM 3:24:46
These dependencies were not found:
* pdfjs-dist/es5/build/pdf.js in ./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--12-0!./node_modules/[email protected]@thread-loader/dist/cjs.js!./node_modules/[email protected]@babel-loader/lib!./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--0-0!./node_modules/[email protected]@vue-loader/lib??vue-loader-options!./node_modules/[email protected]@vue-pdf/src/vuePdfNoSss.vue?vue&type=script&lang=js&
* worker-loader!pdfjs-dist/es5/build/pdf.worker.js in ./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--12-0!./node_modules/[email protected]@thread-loader/dist/cjs.js!./node_modules/[email protected]@babel-loader/lib!./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--0-0!./node_modules/[email protected]@vue-loader/lib??vue-loader-options!./node_modules/[email protected]@vue-pdf/src/vuePdfNoSss.vue?vue&type=script&lang=js&
* pdfjs-dist/es5/web/pdf_viewer in ./node_modules/[email protected]@vue-pdf/src/pdfjsWrapper.js
To install them, you can run: npm install --save pdfjs-dist/es5/build/pdf.js worker-loader!pdfjs-dist/es5/build/pdf.worker.js pdfjs-dist/es5/web/pdf_viewer
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build --mode production`
npm ERR! Exit status 1
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-06-08T07_24_46_457Z-debug.log
ERROR: Job failed: exit status 1
What? Can’t even run the project, so you have to be dissuaded on the first day of employment?! Reluctantly, he spent a whole day searching Baidu and Google, but he didn’t find the problem
After the meeting in the afternoon, the leader passed by his work station and saw Xiao Fang, who was in a mess, asked if the environment had been set up. At this time, Xiao Fang was already suffering from this problem and fed it back to the leaders. Unexpectedly, the leader gently put down the water cup in his hand and did a careful investigation on Xiao Fang’s work position. The leader quickly located the node_ However, it seems that this problem is rather intractable, and it has not been solved after half an hour. In the end, the leader put the
node in his computer_ Moudels
is copied, and the problem is found after replacement
it can be seen vaguely that Xiaofang installed the 2.8.335
version of pdfjs dist, while the leader used 2.5.207
, and this newer version is not compatible with the node environment, resulting in an error.
solve
The problem is that in the development team, the front-end project should not put the package lock. JSON
file used to lock the version into gitignore, because the most critical factor of development is stability rather than the latest
hope to solve your problem, see you~
Read More:
- Error failed to compile with 1 errors
- [Solved] VUE-pdf Plugin use error: To install them, you can run: npm install –save core-js/modules/es
- This dependency was not found:* vue-editor-bridge
- ERROR in ./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/css/spec
- Module not found: Error: Can’t resolve ‘sass-loader’ in ‘F:\H5\project-h5’
- Module build failed: TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string.
- [Solved] This dependency was not found: * core-js/modules/es.error.cause.js in ./node_modules/@babel
- These dependencies were not found
- Error: [VueLoaderPlugin Error] No matching use for vue-loader is found. Make sure the rule matching
- Error failed to compile with 1 errors after finding NPM run dev
- Vue — report error with less module build failed: typeerror: loaderContext.getResolve is not a function
- Webpack error module build failed: typeerror: fileSystem.statSync is not a function
- Module parse failed:Unexpectedtoken (1:0)You may need an appropriate loader to handle this file type
- Using Lombok to compile and report errors
- Vue running error: error failed to compile with 1 errors, browser error: cannot get/
- Failed to execute goal on project XXXX-api: Could not resolve dependencies for pro
- How to Solve Ubuntu18 Compile Kalibr Error (Various Errors)
- scalac: Token not found: C:\Users\User\AppData\Local\JetBrains\IntelliJIdea2020.3\compile-server\to
- Module build failed: Error: ENOENT: no such file or directory, scandir,‘node_modules\node-sass\vend’
- Using webpack to report typeerror: this.getresolve is not a function