Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run-script dev fails #834

Closed
RaisinTen opened this issue Nov 17, 2020 · 4 comments
Closed

npm run-script dev fails #834

RaisinTen opened this issue Nov 17, 2020 · 4 comments

Comments

@RaisinTen
Copy link
Contributor

Hello! 🙂
I tried to run npm run-script dev and it fails. Here is the relevant part of the log:

$ npm run-script dev
...
Running test 'objectwrap'
Running test 'objectwrap_constructor_exception'
Running test 'objectwrap-removewrap'
Running test 'objectwrap_multiple_inheritance'
Running test 'objectwrap_worker_thread'
Running test 'objectreference'

node:events:306
      throw er; // Unhandled 'error' event
      ^
Error: Cannot find module './build/Release/binding.node'
Require stack:
- /home/raisinten/Desktop/universe/git/node-addon-api/test/objectwrap_worker_thread.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
    at Function.Module._load (node:internal/modules/cjs/loader:763:27)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/raisinten/Desktop/universe/git/node-addon-api/test/objectwrap_worker_thread.js:12:10)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
Emitted 'error' event on process instance at:
    at emitUnhandledRejectionOrErr (node:internal/event_target:579:11)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:380:9)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:18:26)
    at MessagePort.callbackTrampoline (node:internal/async_hooks:129:14)
    at Worker.[kOnExit] (node:internal/worker:242:5)
    at Worker.<computed>.onexit (node:internal/worker:177:20)
    at Worker.callbackTrampoline (node:internal/async_hooks:129:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/raisinten/Desktop/universe/git/node-addon-api/test/objectwrap_worker_thread.js'
  ]
}
npm ERR! code 1
npm ERR! path /home/raisinten/Desktop/universe/git/node-addon-api
npm ERR! command failed
npm ERR! command sh -c node test

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/raisinten/.npm/_logs/2020-11-17T13_17_26_544Z-debug.log

@mhdawson
Copy link
Member

I assume you already ran npm install ?

@RaisinTen
Copy link
Contributor Author

Yes, that ran perfectly. :)

@ankushchk
Copy link

npm run <command>

will run bash script from package.json from 'scripts' value of '' attribute. For example:

package.json

   "name": "app",
   "version": "0.0.0",
   "license": "MIT",
   "scripts": {
      "server": "webpack-dashboard -- webpack-dev-server --inline --port 8080",
      "webdriver-update": "webdriver-manager update",
   },
  "dependencies": {
   "@angular/common": "~2.2.0",
   "@angular/core": "~2.2.0"
   },
  "devDependencies": {
   "@types/core-js": "^0.9.0"
   }
}

In this case you can run scripts:

npm run server
npm run webdriver-update

In your case you probably wont have dev script.

Remember that few scripts name are reserved (for example npm test will try to run, npm run pretest, npm run test, npm run posttest). More info on https://docs.npmjs.com/misc/scripts

Simply check the package.json file and see what the name of the key is for dev. In my case it was start instead of dev, so I ran npm run start and that did it.

Screenshot:
Screenshot

@RaisinTen RaisinTen changed the title npm run-script dev fails npm run-script dev:incremental fails Nov 19, 2020
@RaisinTen RaisinTen changed the title npm run-script dev:incremental fails npm run-script dev fails Nov 19, 2020
@RaisinTen
Copy link
Contributor Author

@An-prog-hub actually, the dev script exists already:

"dev": "node test",

RaisinTen added a commit to RaisinTen/node-addon-api that referenced this issue Nov 19, 2020
Since worker threads inherit non-process-specific options by
default, the configuration needs to be shared via workerData.

Fixes: nodejs#834
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this issue Aug 24, 2022
Since worker threads inherit non-process-specific options by
default, the configuration needs to be shared via workerData.

PR-URL: nodejs/node-addon-api#837
Fixes: nodejs/node-addon-api#834
Reviewed-By: Michael Dawson <midawson@redhat.com>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this issue Aug 26, 2022
Since worker threads inherit non-process-specific options by
default, the configuration needs to be shared via workerData.

PR-URL: nodejs/node-addon-api#837
Fixes: nodejs/node-addon-api#834
Reviewed-By: Michael Dawson <midawson@redhat.com>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this issue Sep 19, 2022
Since worker threads inherit non-process-specific options by
default, the configuration needs to be shared via workerData.

PR-URL: nodejs/node-addon-api#837
Fixes: nodejs/node-addon-api#834
Reviewed-By: Michael Dawson <midawson@redhat.com>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this issue Aug 11, 2023
Since worker threads inherit non-process-specific options by
default, the configuration needs to be shared via workerData.

PR-URL: nodejs/node-addon-api#837
Fixes: nodejs/node-addon-api#834
Reviewed-By: Michael Dawson <midawson@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants