1

So this is a project of a client. He gave me his next.js files. So I downloaded the files, then cleared the cache deleted node modules and the package-lock.json file and then installed all the dependencies. But now this weird error is showing when I try to npm start.

info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info  - Checking validity of types
warn  - No ESLint configuration detected. Run next lint to begin setup
info  - Creating an optimized production build  
info  - Compiled successfully

> Build error occurred
Error: Only absolute URLs are supported
    at new ApolloError (C:\Users\User\Desktop\buybeauty-main\node_modules\@apollo\client\errors\errors.cjs.js:34:28)
    at C:\Users\User\Desktop\buybeauty-main\node_modules\@apollo\client\core\core.cjs.js:1593:19
    at both (C:\Users\User\Desktop\buybeauty-main\node_modules\@apollo\client\utilities\utilities.cjs.js:981:53)
    at C:\Users\User\Desktop\buybeauty-main\node_modules\@apollo\client\utilities\utilities.cjs.js:974:72    
    at new Promise (<anonymous>)
    at Object.then (C:\Users\User\Desktop\buybeauty-main\node_modules\@apollo\client\utilities\utilities.cjs.js:974:24)
    at Object.error (C:\Users\User\Desktop\buybeauty-main\node_modules\@apollo\client\utilities\utilities.cjs.js:982:49)
    at notifySubscription (C:\Users\User\Desktop\buybeauty-main\node_modules\zen-observable\lib\Observable.js:140:18)
    at onNotify (C:\Users\User\Desktop\buybeauty-main\node_modules\zen-observable\lib\Observable.js:179:3)   
    at SubscriptionObserver.error (C:\Users\User\Desktop\buybeauty-main\node_modules\zen-observable\lib\Observable.js:240:7) {
  type: 'ApolloError',
  graphQLErrors: [],
  clientErrors: [],
  networkError: {}
}
info  - Collecting page data .npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuskin@0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuskin@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!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2021-09-24T10_55_42_879Z-debug.log

This is my log

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.11
3 info using node@v14.16.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle nuskin@0.1.0~prestart: nuskin@0.1.0
6 info lifecycle nuskin@0.1.0~start: nuskin@0.1.0
7 verbose lifecycle nuskin@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle nuskin@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\User\Desktop\buybeauty-main\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\User\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\User\AppData\Roaming\Python\Python38;C:\Program Files\Git\cmd;C:\Program Files (x86)\Wolfram Research\WolframScript\;C:\Program Files\Wolfram Research\WolframScript\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\nodejs\node_modules\npm\bin;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\User\AppData\Roaming\npm\;
9 verbose lifecycle nuskin@0.1.0~start: CWD: C:\Users\User\Desktop\buybeauty-main
10 silly lifecycle nuskin@0.1.0~start: Args: [ '/d /s /c', 'next start' ]
11 silly lifecycle nuskin@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle nuskin@0.1.0~start: Failed to exec start script
13 verbose stack Error: nuskin@0.1.0 start: `next start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid nuskin@0.1.0
15 verbose cwd C:\Users\User\Desktop\buybeauty-main
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v14.16.0
19 verbose npm  v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error nuskin@0.1.0 start: `next start`
22 error Exit status 1
23 error Failed at the nuskin@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

This is my package.json file

{
  "name": "nuskin",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "svg": "svgr -d src/components/icons src/components/icons/svgs"
  },
  "dependencies": {
    "@apollo/client": "^3.3.16",
    "@stripe/stripe-js": "^1.14.0",
    "@svgr/cli": "^5.5.0",
    "@woocommerce/woocommerce-rest-api": "^1.0.1",
    "axios": "^0.21.1",
    "body-scroll-lock": "^4.0.0-beta.0",
    "classnames": "^2.3.1",
    "firebase": "^9.0.2",
    "graphql": "^15.4.0",
    "lodash": "^4.17.20",
    "micro": "^9.3.4",
    "next": "^11.1.2",
    "next-stripe": "^1.0.0-beta.9",
    "node-fetch": "^2.6.1",
    "nprogress": "^0.2.0",
    "prop-types": "^15.7.2",
    "react": "^17.0.1",
    "react-dom": "17.0.1",
    "sass": "^1.29.0",
    "stripe": "^8.148.0",
    "uuid": "^8.3.1",
    "validator": "^13.1.17"
  },
  "devDependencies": {
    "autoprefixer": "^10.3.4",
    "install": "^0.13.0",
    "postcss": "^8.3.6",
    "postcss-flexbugs-fixes": "^5.0.1",
    "postcss-import": "^13.0.0",
    "postcss-preset-env": "^6.7.0",
    "precss": "^4.0.0",
    "tailwindcss": "^2.2.11"
  }
}

1 Answers1

-1

Why did you delete the package-lock.json? And could you share the logs?

It's possible your Next configuration file isn't included and some values (environment variables for example) aren't readable for your project. So possibly somewhere in the project a URL interface is initialized with an empty value; at new URL (internal/url.js:335:5).

Edblocker
  • 430
  • 1
  • 3
  • 15