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'
Related
Black#DESKTOP-N04CDRI MINGW64 /c/web devlopment/react-chat-application/chat-application (master)
$ npm start
chat-application#0.1.0 start C:\web devlopment\react-chat-application\chat-application
react-scripts start
Could not find a required file.
Name: index.js
Searched in: C:\web devlopment\react-chat-application\chat-application\src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chat-application#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chat-application#0.1.0 start 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! C:\Users\Black\AppData\Roaming\npm-cache_logs\2021-09-29T15_56_51_774Z-debug.log
Black#DESKTOP-N04CDRI MINGW64 /c/web devlopment/react-chat-application/chat-application (master)
$
you may have deleted index.js file or renamed it.if you are using react-create-app pipeline then you can't rename that or remove this file so make sure it's present in your src folder inside project dir and if you are using git then run git status it will tell you what you had changed.
index.html has been moved/removed from the /public directory
Does your project have an index.js file in the public directory?
If not you can get the one that Create React App uses here
---> Running in 0e34d471598d
> myproject#1.0.0 build /app
> node scripts/build.js
Could not find a required file.
Name: index.html
Searched in: /app/public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproject#1.0.0 build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject#1.0.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/2021-08-05T14_49_57_665Z-debug.log
The command '/bin/sh -c npm run build ;' returned a non-zero code: 1
##[error]The command '/bin/sh -c npm run build ;' returned a non-zero code: 1
##[error]The process '/usr/bin/docker' failed with exit code 1
So there is the error "can't find file" but actually THERE IS a public directory with the index.html file inside. I don't know why this is happening...
Edit: Im adding the docker file used in config pipe
# -- Base node --
FROM node:13.7-alpine AS build
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
ARG BUILD_ENV
RUN npm run build ;
# -- final build --
FROM nginx:1.17.8-alpine
COPY --from=build /app/build /var/www
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
I notice you are running this on docker, so you did wrong on docker during copy your react app directory to docker container.
You have not added your Dockerfile code here
So we suggest you to fix your dockerfile first. Also check your .dockerignore file and debug getting into docker container, if the directory exist there or not
So your docker file should be similar to this
COPY . ./
RUN npm run build
It should be like this (Not . /app):
# Copy other project files and build
COPY . ./
RUN npm run build
Im new at Gatsby , when I try to start the Gatsby project gatsby develop --port 8080 , I'm meeting the following error:
WorkerError: Processing C:/Users/AOmurzakov/Desktop/Job/landings/packages/project-business/.cache/gatsby-source-filesystem/6e42032743dd2dda7e331865dd496bd9.png failed
Original error:
jobs-manager.js:314 exports.enqueueJob
[landings]/[gatsby]/dist/utils/jobs-manager.js:314:23
runMicrotasks
task_queues.js:93 processTicksAndRejections
internal/process/task_queues.js:93:5
not finished run queries - 2.879s not finished Generating image
thumbnails - 2.859s
pages
In Progress
#project/businessnpm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR!
lerna# project-business: cd packages/project-business && gatsby
develop --port 8080 npm ERR! Exit status 1 npm ERR! npm ERR! Failed
at the lerna# start:project-business 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!
C:\Users\AOmurzakov\AppData\Roaming\npm-cache_logs\2020-02-12T05_22_16_490Z-debug.log
PS C:\Users\AOmurzakov\Desktop\Job\landings>
I was trying to delete .cach by gatsby clean . It didnt work
Also I was trying to start the project with
12 and 10 version of Node
But it had no effect , same error. Can someone advise ?
Following this GitHub comment and the one above it.
I ran the following commands and it solved the problem in my case.
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install
npm run dev
So in my recent project I tried to install some node modules, in this case, express and MySQL, which both return the same error:
npm WARN thecaptain.ga#1.0.0 No repository field.
npm ERR! path C:\Users\user\projectroot\node_modules\on-finished
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\user\projectroot\node_modules\on-
finished' -> 'C:\Users\user\projectroot\node_modules.on-finished.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
I tried to delete all the related files, then reinstalling it, however that did not change anything. I have run npm init before the install even attempted to fill in the dependency manually, to then run npm install. It happens with every node module in any node project I have.
Turns out the issue was because the dropbox tried to synchronize the files as i was installing the package. Pausing or disabling this fixes the issue...
Could you try this please:
1 - Ensure no NPM scripts are running.
2 - Navigate to your project route
3 - Run this command:
rm package-lock.json && npm i
Note - it may also be worth trying to delete your 'node_modules' folder in your project directory and running the above command.
I'm having a stab at learning Node.js and I'm having a few issues when installing NPM (Node Package Manager). I'm pretty sure it's either a permissions thing or folder thing... please note that I've just purchased a Mac (I've used Windows all my life) and I'm pretty unfamiliar with the Mac terminal.
Okay, I went to use the one line install for NPM: curl http://npmjs.org/install.sh | sh and I got an error...
All clean!
! [ -d .git ] || git submodule update --init --recursive
node cli.js rm npm -g -f
node cli.js install -g -f
npm ERR! Could not create /usr/local/lib/node_modules/___npm.npm
npm ERR! error installing npm#1.0.94 Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.0.0
npm ERR! command "node" "/private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/cli.js" "install" "-g" "-f"
npm ERR! cwd /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package
npm ERR! node -v v0.5.9-pre
npm ERR! npm -v 1.0.94
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCESS
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/npm-debug.log
npm not ok
make: *** [install] Error 1
npm ERR! Could not create /usr/local/lib/node_modules/___npm.npm
npm ERR! error installing npm#1.0.94 Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.0.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package
npm ERR! node -v v0.5.9-pre
npm ERR! npm -v 1.0.94
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCESS
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/npm-debug.log
npm not ok
It failed
there's obviously a folder issue here, perhaps I'm installing in the wrong place, my node folder is at Users/Mike/node, when I try and find out my node path variable using NODE_PATH I get the following error:
Michaels-MacBook-Pro:~ Mike$ node node/NODE_PATH
node.js:203
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '/Users/Mike/node/NODE_PATH'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Array.<anonymous> (module.js:470:10)
at EventEmitter._tickCallback (node.js:195:26)
Can someone please tell me what I'm doing wrong? Do I need to add the node path like such:
$ export PATH=/path/to/node/0.n.y/bin:${PATH}
$ curl http://npmjs.org/install.sh | sh
Or am I confusing myself?
The permissions on /usr/local require you to use sudo to install NPM, or change your permissions. Of these three, I recommend the third option.
Option #1: Use sudo
(Note that the the creator of NPM advises against using this method)
curl http://npmjs.org/install.sh | sudo sh
Option #2: Change permissions
sudo chmod g+rwx /usr/local
sudo chgrp admin /usr/local
Option #3: Use Homebrew
I recommend installing Homebrew to manage installing *nix tools on OS X (I'd stay away from MacPorts & Fink). Installing Homebrew will set the permissions for /usr/local so you can write to it without sudo. You can then install Node via Homebrew, and then install NPM normally:
brew install node --without-npm
curl http://npmjs.org/install.sh | sh
Use curl http://npmjs.org/install.sh | sudo sh.
Edit: You're using node -v v0.5.9-pre, which is very unstable. Use 0.4.12, the latest stable version.
if you are using windows , it takes some steps , 1) create a file called package.json
{
"name": "hello"
, "version": "0.0.1"
, "dependencies": {
"express": "*"
}
}
where hello is the name of the package and * means the latest version of your dependency
2) code to you project directory and run the following command
npm install
As update for the method #3 on OSX the correct command now is:
brew install node --without-npm
curl https://www.npmjs.org/install.sh | sh
Option #4:
Install node local to the user that needs it.
I should clarify for my purposes I needed npm to install appium on an OSX server running Bamboo for our integrated testing. I only had macports available and rather than installing homebrew to manage just the one package I decided to build it from source and install it local to the bamboo user. Which allowed us to run appium as the bamboo user and made it possible to run our appium tests on Bamboo as a not very privileged user.
This guide from Tom Novelli goes over how to do it. The basic gist is:
# Make the dir to hold the installation of node
cd
mkdir ./local
mkdir sources
# Tell npm about your new non-default directories
vi .npmrc
cd sources
# Get node and do the typical source install procedure
wget http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz
tar xf node-v0.10.29.tar.gz
cd node-v8.10.29/
# Important part is the --prefix
./configure --prefix=~/.local
make
make install
# Make a link so node doesn't get confused
cd
ln -s .local/lib/node_modules .node_modules
# Edit PATH to include ~/.local
vi .bashrc
.npmrc
root = /home/YOUR-USERNAME/.local/lib/node_modules
binroot = /home/YOUR-USERNAME/.local/bin
manroot = /home/YOUR-USERNAME/.local/share/man
.bashrc OR .profile OR whereever you like setting your path
export PATH=$HOME/.local/bin:$PATH
Useful Links
The .npmrc man page useful.
And just in case here's a link to node source.