A very annoying pilation problem is happening to my puter regarding JScript and node, I already tried several instructions provided by the internet however the problem seems to persist.
CD>PROJECT
npm init
ok
npm install -g
and locally ok
npm start
> problem with start: script > app.js
or node app.js
ok
If it runs I receive the Windows host server error #800A03EA syntax/pilation issue.
However, if I run the code
npx http-server
, I can do my PWA projects with no issue.
I have already tried several 'fix' tools, repair, registry verification, but none of them seems to solve the situation.
A very annoying pilation problem is happening to my puter regarding JScript and node, I already tried several instructions provided by the internet however the problem seems to persist.
CD>PROJECT
npm init
ok
npm install -g
and locally ok
npm start
> problem with start: script > app.js
or node app.js
ok
If it runs I receive the Windows host server error #800A03EA syntax/pilation issue.
However, if I run the code
npx http-server
, I can do my PWA projects with no issue.
I have already tried several 'fix' tools, repair, registry verification, but none of them seems to solve the situation.
JScript (interpreted by windows script host, WSH) is not the same as JavaScript (interpreted by node*).
The error mentioned sounds as if the JScript interpreter of the Windows Script Host was trying to execute a JavaScript file intended for node.
Make sure you run your code with node (node app.js
) and not with WSH. The default file association in windows for *.JS is WSH so doubleclicking or just running app.js
will run WSH.
Also make sure your start
mand in package.json
is actually set to node app.js
, I get the feeling it is set to just app.js
.
...
"scripts": {
"start": "node app.js"
}
...
Then, npm start
should work.
*: Of course node is not the only interpreter for Javascript, but it's the one relevant here.
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\\Dev\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Users\Dev\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Dev\Desktop\Fetch api\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python38\Scripts\;C:\Python38\;C:\Program Files (x86)\Intel\TXE Components\iCLS\;C:\Program Files\Intel\TXE Components\iCLS\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Intel\TXE Components\DAL\;C:\Program Files (x86)\Intel\TXE Components\DAL\;C:\Program Files\Intel\TXE Components\IPT\;C:\Program Files (x86)\Intel\TXE Components\IPT\;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;C:\Users\Dev\AppData\Local\Microsoft\WindowsApps;;C:\Users\Dev\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Dev\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\Users\Dev\Desktop\Fetch api
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'node scripts.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `node scripts.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Dev\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:310:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Dev\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:310: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 [email protected]
15 verbose cwd C:\Users\Dev\Desktop\Fetch api
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Dev\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.16.3
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `node scripts.js`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
PS C:\Users\Dev\Desktop\Fetch api> npm start
> [email protected] start C:\Users\Dev\Desktop\Fetch api
> node scripts.js
C:\Users\Dev\Desktop\Fetch api\scripts.js:1
var button = document.querySelector('.button')
^
ReferenceError: document is not defined
at Object.<anonymous> (C:\Users\Dev\Desktop\Fetch api\scripts.js:1:14)
at Module._pile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node scripts.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete log of this run can be found in:
npm ERR! C:\Users\Dev\AppData\Roaming\npm-cache\_logs\2020-05-23T18_39_34_693Z-debug.log
PACKAGE JSON
{
"name": "np",
"version": "1.0.0",
"main": "script.js",
"scripts": {
"start": "node scripts.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"npm": "^6.14.5",
"prpl-server": "^1.4.0"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "https://github./mendesbayout/Fetch-api-simple-forecast.git"
},
"bugs": {
"url": "https://github./mendesbayout/Fetch-api-simple-forecast/issues"
},
"homepage": "https://github./mendesbayout/Fetch-api-simple-forecast#readme",
"description": ""
}
Add this line at the beginning of the js file:
#!/usr/bin/env node
It will tell your system which interpreter use to run the file