I'm developing a nextJS app on a macOS machine. After running npm install
, I moved all the files to a windows (10) machine, which has no internet connection. Running npm run dev
is surprisingly not working. I do get an error which can be losley translated to the command "next" is written wrongly or cannot be found
.
I do not see, what is wrong with my nextJS app - which is just the official example app, so it should work (and it is working on my macOS machine).
Is there any configuration missing on the windows machine? Running node -v
and npm -v
are returning the latest version.
output
C:\Users\User\nextjs-blog>npm run dev
> learn-starter@0.1.0 dev C:\Users\User\nextjs-blog
> next dev
Der Befehl "next" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! learn-starter@0.1.0 dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the learn-starter@0.1.0 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\2020-07-02T07_18_21_223Z-debug.log
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 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v12.18.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle learn-starter@0.1.0~predev: learn-starter@0.1.0
6 info lifecycle learn-starter@0.1.0~dev: learn-starter@0.1.0
7 verbose lifecycle learn-starter@0.1.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle learn-starter@0.1.0~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\User\nextjs-blog\node_modules\.bin;C:\Users\User\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle learn-starter@0.1.0~dev: CWD: C:\Users\User\nextjs-blog
10 silly lifecycle learn-starter@0.1.0~dev: Args: [ '/d /s /c', 'next dev' ]
11 silly lifecycle learn-starter@0.1.0~dev: Returned: code: 1 signal: null
12 info lifecycle learn-starter@0.1.0~dev: Failed to exec dev script
13 verbose stack Error: learn-starter@0.1.0 dev: `next dev`
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:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid learn-starter@0.1.0
15 verbose cwd C:\Users\User\nextjs-blog
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v12.18.1
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error learn-starter@0.1.0 dev: `next dev`
22 error Exit status 1
23 error Failed at the learn-starter@0.1.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I deployed node.js app on CentOS with no internet connection.
Develop on Mac and yarn install, I moved all Files, but get errors on CentOS.
I finish that project with npm install with CentOS in virtual machine.
===
Here is not any miracles, and can not be option like npm install --linux-but-i-am-on-windows. You just need linux machine with interned to build your product on it (say perform npm install), and then copy project to the prod server. Jenkins or Bamboo could help
Is there a difference between npm install on windows & linux
I have so many time this issue with reactjs or nextjs
I first do :
STEP 1: clear the cache npm cache clean --force
STEP 2: delete node-modules
and package-lock-json
rm -rf node-modules package-lock-json
or remove them manuelly
STEP 3: install 'npm'
npm install
And then npm start
If that FAIL : you can debug on VSCode
On the package.json' file click on
Debug` button
Chose the right select and the debug's extension will run and debug.
At the end npm start
or 'npm run dev`
reactjs next.js VSC
You can get it to work if you run
npm install --force
that gets the app to show when I ran it on localhost:3000
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.