EmbedAI icon indicating copy to clipboard operation
EmbedAI copied to clipboard

unable to run npm run dev

Open cyonghui81 opened this issue 1 year ago • 9 comments

C:>cd C:\Users\User\Documents\Learning\privateGPT2\privateGPT-main\client

C:\Users\User\Documents\Learning\privateGPT2\privateGPT-main\client>npm run dev

[email protected] dev C:\Users\User\Documents\Learning\privateGPT2\privateGPT-main\client next dev

C:\Users\User\Documents\Learning\privateGPT2\privateGPT-main\client\node_modules\next\dist\cli\next-dev.js:256 showAll: args["--show-all"] ?? false, ^

SyntaxError: Unexpected token '?' at Module._compile (internal/modules/cjs/loader.js:892:18) at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10) at Module.load (internal/modules/cjs/loader.js:812:32) at Function.Module._load (internal/modules/cjs/loader.js:724:14) at Module.require (internal/modules/cjs/loader.js:849:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.dev (C:\Users\User\Documents\Learning\privateGPT2\privateGPT-main\client\node_modules\next\dist\lib\commands.js:15:30) at Object. (C:\Users\User\Documents\Learning\privateGPT2\privateGPT-main\client\node_modules\next\dist\bin\next:150:28) at Module._compile (internal/modules/cjs/loader.js:956:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] dev: next dev npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dev 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\2023-05-29T07_17_34_828Z-debug.log

C:\Users\User\Documents\Learning\privateGPT2\privateGPT-main\client>

cyonghui81 avatar May 29 '23 07:05 cyonghui81

Please check if you have installed node and npm

Anil-matcha avatar May 29 '23 09:05 Anil-matcha

can not run the client, SyntaxError: Unexpected token '??=' at cjs/loader.js

Crushdada avatar May 29 '23 10:05 Crushdada

npm is the wrong version.

npm -v will give you the version number.

Here is my build script.

apt update -y
apt install -y curl
curl -sL https://deb.nodesource.com/setup_18.x | bash -

apt install -y git nodejs python3 curl build-essential
curl https://bootstrap.pypa.io/get-pip.py | python3

cd /root
git clone https://github.com/SamurAIGPT/privateGPT.git
cd privateGPT/client

npm install

cd /root
cd privateGPT/server
pip3 install -r requirements.txt

RattyDAVE avatar May 29 '23 10:05 RattyDAVE

@RattyDAVE Thanks for sharing

@cyonghui81 @Crushdada Please update your npm version

Anil-matcha avatar May 29 '23 11:05 Anil-matcha

No problem. I had the same battle myself.

RattyDAVE avatar May 31 '23 09:05 RattyDAVE

I am getting a similar issue, but my npm is fully up to date and I tried following the build script above.

[email protected] dev next dev

/root/privateGPT/client/node_modules/next/dist/cli/next-dev.js:256 showAll: args["--show-all"] ?? false, ^

SyntaxError: Unexpected token '?' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.dev (/root/privateGPT/client/node_modules/next/dist/lib/commands.js:15:30) at Object. (/root/privateGPT/client/node_modules/next/dist/bin/next:150:28) at Module._compile (internal/modules/cjs/loader.js:999:30)

YoeJates avatar May 31 '23 10:05 YoeJates

I had that too.

curl -sL https://deb.nodesource.com/setup_18.x | bash -

Solved it.

RattyDAVE avatar May 31 '23 11:05 RattyDAVE

Here are my versions that work.

root@79fe99adb8e1:/# pip -V
pip 23.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
root@79fe99adb8e1:/# npm -v
9.5.1

RattyDAVE avatar May 31 '23 11:05 RattyDAVE

@YoeJates Looks like a common issue https://stackoverflow.com/questions/74707066/nextjs-unexpected-token

You need to update nvm

Anil-matcha avatar May 31 '23 14:05 Anil-matcha

Closing due to inactivity

Anil-matcha avatar Jun 09 '23 18:06 Anil-matcha