skip to Main Content

When executing npm start in the terminal I am greeted with this error message:

PS C:UsersfinsaOneDriveDocumentsUNIWeb DevelopmentNS_Music_App> npm start

> [email protected] start
> nw src/

(node:6380) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error: spawn C:UsersfinsaOneDrive`your text`DocumentsUNIWeb DevelopmentNS_Music_Appnwjs-sdk-v0.86.0-win-x64nw.exe ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\Users\finsa\OneDrive\Documents\UNI\Web Development\NS_Music_App\nwjs-sdk-v0.86.0-win-x64\nw.exe',
  path: 'C:\Users\finsa\OneDrive\Documents\UNI\Web Development\NS_Music_App\nwjs-sdk-v0.86.0-win-x64\nw.exe',
  spawnargs: [ 'src/' ]
}
node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^

Error: spawn C:UsersfinsaOneDriveDocumentsUNIWeb DevelopmentNS_Music_Appnwjs-sdk-v0.86.0-win-x64nw.exe ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\Users\finsa\OneDrive\Documents\UNI\Web Development\NS_Music_App\nwjs-sdk-v0.86.0-win-x64\nw.exe',
  path: 'C:\Users\finsa\OneDrive\Documents\UNI\Web Development\NS_Music_App\nwjs-sdk-v0.86.0-win-x64\nw.exe',
  spawnargs: [ 'src/' ]
}

Node.js v20.12.2

Here is how my project is formatted

./package.json:

{
    "name": "ns_music_app",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "start": "nw src/",
        "prod": "nwbuild --platforms win32,win64,osx64,linux32,linux64 --buildDir dist/ src/"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "nw": "^0.86.0-sdk",
        "nw-builder": "^4.7.1"
    }
}

./src/package.json:

{
    "name": "src",
    "version": "1.0.0",
    "description": "",
    "main": "views/main.html",
    "scripts": {
        "test": "echo "Error: no test specified" && exit 1"
    },
    "window": {
        "title": "NS-Music-App"
    },
    "keywords": [],
    "author": "",
    "license": "ISC"
}

I have tried uninstalling and reinstalling Node.js, node-webkit, and reinitialising package.json files. I have also ensured that ignore-script is configured to false.

I suspect that it has something tp do with the path used to fetch nw.exe as in the error message it returns Web Development\NS_Music_App\nwjs-sdk-v0.86.0-win-x64\nw.exe when the actual file path should be Web Development\NS_Music_App\node_modules\nw\nwjs-sdk-v0.86.0-win-x64\nw.exe. But I’m not sure how to fix this.

2

Answers


  1. I think you just need to change "start": "nw src/", to "start": "nw ./src",.

    I made an example repo:

    Login or Signup to reply.
  2. I had a similar issue, a way to get it to work was if i downloaded the source files from the NW.js site for the same version i installed from npm, and replaced the zipped folder in the projects node_modules/nw with an unzipped file from the downloaded source files. Then running npm start worked. Also verify if you should be running "start": "nw src/" or "start": "nw ."

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search