简体   繁体   中英

How do I install dependencies that NPM refuses to install?

On running a docker build, I get an error with core-js dependencies missing. On running npm's suggested install command, I get another error. I tried to revert to a couple of earlier branches, but no cigar.

The error on docker build . is:

ERROR  Failed to compile with 122 errors5:31:56 AM

These dependencies were not found:

* core-js/modules/es6.array.copy-within in ./src/main.js
* core-js/modules/es6.array.fill in ./src/main.js
* core-js/modules/es6.array.find in ./src/main.js
* core-js/modules/es6.array.find-index in ./src/main.js
* core-js/modules/es6.array.from in ./src/main.js
* core-js/modules/es6.array.iterator in ./src/main.js
* core-js/modules/es6.array.of in ./src/main.js
* core-js/modules/es6.array.sort in ./src/main.js
* core-js/modules/es6.array.species in ./src/main.js
* core-js/modules/es6.date.to-primitive in ./src/main.js
...

Along with another hundred similar lines, followed by this suggestion:

To install them, you can run: npm install --save core-js/modules/es6.array.copy-within core-js/modules/es6.array.fill core-js/modules/es6.array.find core-js/modules/es6.array.find-index core-js/modules/es6.array.from core-js/modules/es6.array.iterator core-js/modules/es6.array.of core-js/modules/es6.array.sort core-js/modules/es6.array.species core-js/modules/es6.date.to-primitive core-js/modules/es6.function.has-instance core-js/modules/es6.function.name core-js/modules/es6.map core-js/modules/es6.math.acosh core-js/modules/es6.math.asinh core-js/modules/es6.math.atanh core-js/modules/es6.math.cbrt core-js/modules/es6.math.clz32 core-js/modules/es6.math.cosh core-js/modules/es6.math.expm1 core-js/modules/es6.math.fround core-js/modules/es6.math.hypot core-js/modules/es6.math.imul core-js/modules/es6.math.log10 core-js/modules/es6.math.log1p core-js/modules/es6.math.log2 core-js/modules/es6.math.sign core-js/modules/es6.math.sinh core-js/modules/es6.math.tanh core-js/modules/es6.math.trunc core-js/modules/es6.number.constructor core-js/modules/es6.number.epsilon core-js/modules/es6.number.is-finite core-js/modules/es6.number.is-integer core-js/modules/es6.number.is-nan core-js/modules/es6.number.is-safe-integer core-js/modules/es6.number.max-safe-integer core-js/modules/es6.number.min-safe-integer core-js/modules/es6.number.parse-float core-js/modules/es6.number.parse-int core-js/modules/es6.object.assign core-js/modules/es6.object.freeze core-js/modules/es6.object.get-own-property-descriptor core-js/modules/es6.object.get-own-property-names core-js/modules/es6.object.get-prototype-of core-js/modules/es6.object.is core-js/modules/es6.object.is-extensible core-js/modules/es6.object.is-frozen core-js/modules/es6.object.is-sealed core-js/modules/es6.object.keys core-js/modules/es6.object.prevent-extensions core-js/modules/es6.object.seal core-js/modules/es6.object.set-prototype-of core-js/modules/es6.promise core-js/modules/es6.reflect.apply core-js/modules/es6.reflect.construct core-js/modules/es6.reflect.define-property core-js/modules/es6.reflect.delete-property core-js/modules/es6.reflect.get core-js/modules/es6.reflect.get-own-property-descriptor core-js/modules/es6.reflect.get-prototype-of core-js/modules/es6.reflect.has core-js/modules/es6.reflect.is-extensible core-js/modules/es6.reflect.own-keys core-js/modules/es6.reflect.prevent-extensions core-js/modules/es6.reflect.set core-js/modules/es6.reflect.set-prototype-of core-js/modules/es6.regexp.constructor core-js/modules/es6.regexp.flags core-js/modules/es6.regexp.match core-js/modules/es6.regexp.replace core-js/modules/es6.regexp.search core-js/modules/es6.regexp.split core-js/modules/es6.regexp.to-string core-js/modules/es6.set core-js/modules/es6.string.anchor core-js/modules/es6.string.big core-js/modules/es6.string.blink core-js/modules/es6.string.bold core-js/modules/es6.string.code-point-at core-js/modules/es6.string.ends-with core-js/modules/es6.string.fixed core-js/modules/es6.string.fontcolor core-js/modules/es6.string.fontsize core-js/modules/es6.string.from-code-point core-js/modules/es6.string.includes core-js/modules/es6.string.italics core-js/modules/es6.string.iterator core-js/modules/es6.string.link core-js/modules/es6.string.raw core-js/modules/es6.string.repeat core-js/modules/es6.string.small core-js/modules/es6.string.starts-with core-js/modules/es6.string.strike core-js/modules/es6.string.sub core-js/modules/es6.string.sup core-js/modules/es6.symbol core-js/modules/es6.typed.array-buffer core-js/modules/es6.typed.float32-array core-js/modules/es6.typed.float64-array core-js/modules/es6.typed.int16-array core-js/modules/es6.typed.int32-array core-js/modules/es6.typed.int8-array core-js/modules/es6.typed.uint16-array core-js/modules/es6.typed.uint32-array core-js/modules/es6.typed.uint8-array core-js/modules/es6.typed.uint8-clamped-array core-js/modules/es6.weak-map core-js/modules/es6.weak-set core-js/modules/es7.array.includes core-js/modules/es7.object.define-getter core-js/modules/es7.object.define-setter core-js/modules/es7.object.entries core-js/modules/es7.object.get-own-property-descriptors core-js/modules/es7.object.lookup-getter core-js/modules/es7.object.lookup-setter core-js/modules/es7.object.values core-js/modules/es7.promise.finally core-js/modules/es7.string.pad-end core-js/modules/es7.string.pad-start core-js/modules/es7.symbol.async-iterator core-js/modules/web.dom.iterable

and ending in:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the frontend@0.1.0 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/2020-03-24T05_31_56_496Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1

I tried running npm's suggestion, which resulted in:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "core-js/modules/es6.array.copy-within" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/orb/.npm/_logs/2020-03-24T05_44_47_462Z-debug.log

I'm quite confused. I'm not sure how I'm missing core-js modules because the last time I ran the build (a couple of days ago), I had not issues. Any idea what's going on here?

Dockerfile:

FROM node:lts-alpine as updraft-frontend-build-stage

#install http server
RUN npm install -g http-server

#make app folder in current directory
WORKDIR /app

#copy package.json and package-lock.json
COPY package*.json ./

#install project dependencies
RUN npm install

#copy in project files & folders
COPY . . 

#build app with minification
RUN npm run build

# EXPOSE 8080
# CMD ["http-server", "dist"]

#production stage
FROM nginx:stable-alpine as updraft-frontend-production-stage
COPY --from=updraft-frontend-build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Update:

Tried running the docker build without the cached layers, but no luck there either.

NPM won't install the missing files because they're part of core-js. running

npm i -S core-js@2.5.7

did the trick.

This thread has a few alternative options if you're interested: Module not found: Error: Can't resolve 'core-js/es6'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM