npm start throwing error status 1 require is not a function - javascript

I get the following error when running npm start.
> app#0.1.0 start /Users/user/Desktop/react-tutorial
> react-scripts start
require(...) is not a function
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app#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:
Here is the actual error
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm#6.4.1
3 info using node#v10.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle app#0.1.0~prestart: app#0.1.0
6 info lifecycle app#0.1.0~start: app#0.1.0
7 verbose lifecycle app#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle app#0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/user/Desktop/react-tutorial/node_modules/.bin:/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin:/Users/user/Library/Android/sdk/tools:/Users/user/Library/Android/sdk/platform-tools:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/opt/local/share/java/android-sdk-macosx/platform-tools:/Users/user/.android-sdk-macosx/platform-tools/:/Users/user/.android-sdk-macosx/platform-tools/:/Users/user/Library/Android/sdk/platform-tools/
9 verbose lifecycle app#0.1.0~start: CWD: /Users/user/Desktop/react-tutorial
10 silly lifecycle app#0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle app#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle app#0.1.0~start: Failed to exec start script
13 verbose stack Error: app#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid app#0.1.0
15 verbose cwd /Users/user/Desktop/react-tutorial
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v10.15.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error app#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the app#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 just started to happen when i restarted computer...why
I can't find anywhere where I am calling require()... maybe a plugin I installed?

In my case, had created a setupProxy.js file at project level, later i removed the configurations in it but not the file. Hence the mentioned error in question was thrown. To resolve, try one of the following according to your need,
update the proper configuration in the setupProxy.js
delete the setupProxy.js if not needed
don't leave the setupProxy.js as empty file

Delete nodes_modules
npm install -g npm
npm install & npm install -D
npm run start

Thanks to #Srinivas's response in the comment of the question.
Delete the generated setupProxy.js file. If you want to use a proxy, instead add it into your package.json file.
"proxy": "http://localhost:3000",
For a setupProxy.js file like so:
const proxy = require('http-proxy-middleware');
// tells the browser to direct any relative reference paths to the below
// domain instead of our own
module.exports = function(app) {
app.use(proxy('/api/*', { target: 'http://localhost:3000' }));*/
};

When you are setting up a Proxy to make a request to a different server
First Step is to install the dependency
npm install --save http-proxy-middleware
Next create setupProxy.js file
setupProxy.js
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/api',
createProxyMiddleware({
target: 'http://localhost:3001',
changeOrigin: true
})
);
};

Related

Why when I make a change in the Js file the local server stopped when it's running?

Why when I run npm run dev and make any changes in the Js file the local server stopped when it's running and that's happened for windows os only I tried that for Linux and works fine.
it gives me the next error :
C:\Users\osama\OneDrive\Desktop\calculator workflow\scripts\development.js:66
if (err) throw err;
^
[Error: EPERM: operation not permitted, copyfile 'C:\Users\osama\OneDrive\Desktop\calculator workflow\src\scripts\main.js' -> 'C:\Users\osama\OneDrive\Desktop\calculator workflow\.tmp'] {
errno: -4048,
code: 'EPERM',
syscall: 'copyfile',
path: 'C:\\Users\\osama\\OneDrive\\Desktop\\calculator workflow\\src\\scripts\\main.js',
dest: 'C:\\Users\\osama\\OneDrive\\Desktop\\calculator workflow\\.tmp'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `node ./scripts/task-runner/tasks.js serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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\osama\AppData\Roaming\npm-cache\_logs\2021-11-23T16_47_01_115Z-debug.log
and this is the log file :
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:\\Users\\osama\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.14.11
3 info using node#v14.16.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle #~predev: #
6 info lifecycle #~dev: #
7 verbose lifecycle #~dev: unsafe-perm in lifecycle true
8 verbose lifecycle #~dev: PATH: C:\Users\osama\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\osama\OneDrive\Desktop\calculator workflow\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\osama\bin;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:\Program Files\Git\cmd;C:\Program Files\dotnet;C:\Program Files (x86)\dotnet;C:\Program Files\nodejs;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;%SYSTEMROOT%\System32\OpenSSH;C:\Users\osama\AppData\Local\Microsoft\WindowsApps;C:\Users\osama\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\osama\AppData\Local\hyper\app-3.0.2\resources\bin;C:\Users\osama\AppData\Roaming\npm
9 verbose lifecycle #~dev: CWD: C:\Users\osama\OneDrive\Desktop\calculator workflow
10 silly lifecycle #~dev: Args: [ '/d /s /c', 'node ./scripts/task-runner/tasks.js serve' ]
11 silly lifecycle #~dev: Returned: code: 1 signal: null
12 info lifecycle #~dev: Failed to exec dev script
13 verbose stack Error: # dev: `node ./scripts/task-runner/tasks.js serve`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\osama\AppData\Roaming\npm\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:\Users\osama\AppData\Roaming\npm\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 #
15 verbose cwd C:\Users\osama\OneDrive\Desktop\calculator workflow
16 verbose Windows_NT 10.0.22000
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\osama\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v14.16.1
19 verbose npm v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error # dev: `node ./scripts/task-runner/tasks.js serve`
22 error Exit status 1
23 error Failed at the # 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 didn't understand why this happen in windows only and works fine for Linux with track changes and the server never stopped.

Failed to compile ./src/App.js Module not found

I am having a problem running my system on my local server.
I tried running npm install then npm run start then I start getting this error :
Failed to compile
./src/app/App.js
Module not found: Can't resolve 'assets/css/style.css' in '/Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console/src/app'
I tried npm install npm run build then I get the following error :
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! console2#0.1.0 build: `npm run build-css && react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the console2#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! /Users/av/.npm/_logs/2021-09-27T13_40_54_796Z-debug.log
I checked the logged file and I found this :
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm#6.14.15
3 info using node#v14.17.6
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle console2#0.1.0~prebuild: console2#0.1.0
6 info lifecycle console2#0.1.0~build: console2#0.1.0
7 verbose lifecycle console2#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle console2#0.1.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle console2#0.1.0~build: CWD: /Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console
10 silly lifecycle console2#0.1.0~build: Args: [ '-c', 'npm run build-css && react-scripts build' ]
11 silly lifecycle console2#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle console2#0.1.0~build: Failed to exec build script
13 verbose stack Error: console2#0.1.0 build: `npm run build-css && react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid console2#0.1.0
15 verbose cwd /Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v14.17.6
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error console2#0.1.0 build: `npm run build-css && react-scripts build`
22 error Exit status 1
23 error Failed at the console2#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I tried the following steps but I'm getting the same error :
npm cache clean --force
delete node_modules folder
delete package-lock.json file
sudo npm install npm#latest -g this will upgrade npm to latest version
npm audit fix --force
npm upgrade --force
npm install
should assets/css/style.css be ../assets/css/style.css or some other relative path depending on what file it is in?

React.JS App MODULE_NOT_FOUND error on 'npm start'

After creating a react application, when I run the command npm start I have the following error:
PS G:\workspace\WEB\gab-web\client> npm start
> client#0.1.0 start G:\workspace\WEB\gab-web\client
> react-scripts start
internal/modules/cjs/loader.js:628
throw e;
^
Error: No valid exports main found for 'G:\workspace\WEB\gab-web\client\node_modules\postcss-safe-parser\node_modules\postcss'
at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
at applyExports (internal/modules/cjs/loader.js:502:14)
at resolveExports (internal/modules/cjs/loader.js:551:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
at Function.Module._load (internal/modules/cjs/loader.js:855:27)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (G:\workspace\WEB\gab-web\client\node_modules\postcss-safe-parser\lib\safe-parse.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1144:30) {
code: 'MODULE_NOT_FOUND'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client#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\gabri\AppData\Roaming\npm-cache\_logs\2021-01-10T19_26_53_509Z-debug.log
And here's the full log file :
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.13.4
3 info using node#v13.6.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle client#0.1.0~prestart: client#0.1.0
6 info lifecycle client#0.1.0~start: client#0.1.0
7 verbose lifecycle client#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle client#0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;G:\workspace\WEB\gab-web\client\node_modules\.bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\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:\Users\gabri\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_221\bin;C:\Program Files\WorldPainter;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\gabri\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\gabri\AppData\Local\Programs\Python\Python38-32\;C:\Users\gabri\AppData\Local\Microsoft\WindowsApps;C:\Users\gabri\AppData\Roaming\Dashlane\6.1937.0.23352\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\gabri\AppData\Roaming\Dashlane\6.1937.0.23352\ucrt;C:\Users\gabri\AppData\Roaming\Dashlane\6.1937.0.23352\bin\Qt;C:\Users\gabri\AppData\Roaming\Dashlane\6.1937.0.23352\bin\Ssl;C:\Users\gabri\AppData\Roaming\npm;D:\workspace\ffmpeg\bin;C:\Users\gabri\AppData\Local\atom\bin;C:\Users\gabri\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\gabri\AppData\Local\Microsoft\WindowsApps;C:\Users\gabri\AppData\Local\GitHubDesktop\bin
9 verbose lifecycle client#0.1.0~start: CWD: G:\workspace\WEB\gab-web\client
10 silly lifecycle client#0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle client#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle client#0.1.0~start: Failed to exec start script
13 verbose stack Error: client#0.1.0 start: `react-scripts 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:321: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:321:20)
13 verbose stack at maybeClose (internal/child_process.js:1028:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid client#0.1.0
15 verbose cwd G:\workspace\WEB\gab-web\client
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 v13.6.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error client#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the client#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 ]
Try upgrading your npm to v14.5 or later, also remove react-create-app globally:
npm uninstall -g create-react-app
and then try recreating your project:
npx create-react-app myapp
It's a known issue, credits: https://github.com/facebook/create-react-app/issues/9273#issuecomment-654182223
I have faced this issue during installing node js on my system so i have tried to change the directory ( File installation ) for node js & it works...
Changed Destination:-
C:\JAVA\
Whenever you face such issues the solution related to your file path not found is because when you start a project and you stop and when you want to go back to such project . many developers tend to forget they need to change directory into the app they created . for example let me say the name of the app was clean-app and you have cleared your server out and to go back to such projects prior to using npm start , you need to cd into the directory or else it will keep stating "[] module not found" and this happen to me a few times before I remembered I had to Cd into the file, so to solve such issues , you cd into the the name of the app and then you type npm start and when you clone someones project and maybe the persons main file and and start file are different , try checking the main file and and changing the name of the main file to that of the start file in the package.json. Thanks
C:\Users\Bikram\Desktop\All works & Files\react\practice\project>npm start
project#0.1.0 start
react-scripts start
'Files\react\practice\project\node_modules.bin' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:1050
throw err;
^
Error: Cannot find module 'C:\Users\Bikram\Desktop\react-scripts\bin\react-scripts.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
at Module._load (node:internal/modules/cjs/loader:893:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
anyone please
please solve this problem.
I had the same issue and I simply deleted tsconfig.js file and restarted npm start. Problem was solved.

'node' is not recognized as an internal or external command, operable program or batch file

I'm running "npm install node-sass" from git-bash-cli in Windows 10 and getting a "'node' is not recognized as an internal or external command,
operable program or batch file." error.
I have been using this setup for years and the issues started when I upgraded node to 10.16.0
To prevent unnecessary replies:
All the questions I have seen simply say to add the path variable.
I have added Node to the PATH variable and tried a number of different ways of writing it. I ended up reinstalling Node.js and that does it automatically, so I just left it as that.
node runs from the command line, just not from scripts, like scripts in the package.json file.
I have tried reinstalling node 8.11.3, which is the version I was using before the problems started, but I get the same error. I am back to v 10.16.0 again.
Error code is as follows:
> node-sass#4.12.0 install C:\projects\true\true\website\truevue\node_modules\node-sass
> node scripts/install.js
'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.0.7 (node_modules\#nuxt\builder\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.12.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.12.0 install 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\Peter\AppData\Roaming\npm-cache\_logs\2019-07-24T23_41_06_896Z-debug.log
Here's the log when I run npm run dev on a Vue project I'm working on
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Peter\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using npm#6.10.2-next.1
3 info using node#v10.16.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle thisistrue.co#1.0.0~predev: thisistrue.co#1.0.0
6 info lifecycle thisistrue.co#1.0.0~dev: thisistrue.co#1.0.0
7 verbose lifecycle thisistrue.co#1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle thisistrue.co#1.0.0~dev: PATH: C:\Users\Peter\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\projects\true\true\website\truevue\node_modules\.bin
9 verbose lifecycle thisistrue.co#1.0.0~dev: CWD: C:\projects\true\true\website\truevue
10 silly lifecycle thisistrue.co#1.0.0~dev: Args: [ '/d /s /c',
10 silly lifecycle 'cross-env NODE_ENV=development nodemon server/index.js --watch server' ]
11 silly lifecycle thisistrue.co#1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle thisistrue.co#1.0.0~dev: Failed to exec dev script
13 verbose stack Error: thisistrue.co#1.0.0 dev: `cross-env NODE_ENV=development nodemon server/index.js --watch server`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Peter\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:317:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Peter\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid thisistrue.co#1.0.0
15 verbose cwd C:\projects\true\true\website\truevue
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Peter\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v10.16.0
19 verbose npm v6.10.2-next.1
20 error code ELIFECYCLE
21 error errno 1
22 error thisistrue.co#1.0.0 dev: `cross-env NODE_ENV=development nodemon server/index.js --watch server`
22 error Exit status 1
23 error Failed at the thisistrue.co#1.0.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 ]
Finally found an answer to this.
All I ended up doing was running npm update -g and it fixed the issue
Thanks all who helped, hope this can help someone else
I think you must add the path of node.js to the system variable
First: open Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables
Second: in "User variables" or "System variables" find variable PATH and add node.js folder path as value.it is C:\Program Files\nodejs;If it doesn't exists, create it.
Third: Restart your computer.

npm script defined in package.json throws errors

I've installed the eslint package and added a series of scripts to package.json.
"scripts": {
"start": "node index.js",
"test": "node_modules/.bin/jasmine-node spec --color --verbose --autotest --watch .",
"acceptance": "node_modules/.bin/forever stopall && node_modules/.bin/forever start index.js && ./node_modules/.bin/jasmine-node test/ --verbose && node_modules/.bin/forever stopall",
"coverage": "./node_modules/.bin/istanbul cover -x **spec/** -x **index.js** -x **debug.js** jasmine-node spec",
"doc": "node_modules/.bin/jsdoc modules/",
"linter": "node_modules/.bin/eslint ."
}
When running these scripts I meet with mixed success. npm run test, nom run coverage, nom run doc all run without errors but npm run acceptance and npm run linter run the script then throw a series of errors, (I have copied the linter example below).
npm ERR! Darwin 16.0.0
npm ERR! argv "/Users/user/.nvm/versions/node/v6.7.0/bin/node"
"/Users/user/.nvm/versions/node/v6.7.0/bin/npm" "run" "linter"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! todo#1.0.0 linter: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todo#1.0.0 linter script 'eslint .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the todo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs todo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls todo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/user/Documents/todo/npm-debug.log
The acceptance tests won't even start the script before running. Why am I getting these errors? The contents of npm-debug.log are:
0 info it worked if it ends with ok
1 verbose cli [ '/Users/user/.nvm/versions/node/v6.7.0/bin/node',
1 verbose cli '/Users/user/.nvm/versions/node/v6.7.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'linter' ]
2 info using npm#3.10.3
3 info using node#v6.7.0
4 verbose run-script [ 'prelinter', 'linter', 'postlinter' ]
5 info lifecycle todo#1.0.0~prelinter: todo#1.0.0
6 silly lifecycle todo#1.0.0~prelinter: no script for prelinter, continuing
7 info lifecycle todo#1.0.0~linter: todo#1.0.0
8 verbose lifecycle todo#1.0.0~linter: unsafe-perm in lifecycle true
9 verbose lifecycle todo#1.0.0~linter: PATH: /Users/user/.nvm/versions/node/v6.7.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/user/Documents/todo/node_modules/.bin:/Users/user/.nvm/versions/node/v6.7.0/bin:/Users/user/google-cloud-sdk/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/user/.nvm/versions/node/v6.7.0/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/texbin
10 verbose lifecycle todo#1.0.0~linter: CWD: /Users/user/Documents/todo
11 silly lifecycle todo#1.0.0~linter: Args: [ '-c', 'eslint .' ]
12 silly lifecycle todo#1.0.0~linter: Returned: code: 1 signal: null
13 info lifecycle todo#1.0.0~linter: Failed to exec linter script
14 verbose stack Error: todo#1.0.0 linter: `eslint .`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/Users/user/.nvm/versions/node/v6.7.0/lib/node_modules/npm/lib/utils/lifecycle.js:242:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/Users/user/.nvm/versions/node/v6.7.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid todo#1.0.0
16 verbose cwd /Users/user/Documents/todo
17 error Darwin 16.0.0
18 error argv "/Users/user/.nvm/versions/node/v6.7.0/bin/node" "/Users/user/.nvm/versions/node/v6.7.0/bin/npm" "run" "linter"
19 error node v6.7.0
20 error npm v3.10.3
21 error code ELIFECYCLE
22 error todo#1.0.0 linter: `eslint .`
22 error Exit status 1
23 error Failed at the todo#1.0.0 linter script 'eslint .'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the todo package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error eslint .
23 error You can get information on how to open an issue for this project with:
23 error npm bugs todo
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls todo
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Categories