Running yarn scripts in WebStorm with non-system node binary

I am trying to use WebStorm for a new project and use yarn instead of npm. However, after building the project, I cannot get the scripts to work through the yarn. My start script has the following launch configuration in WebStorm.

package.json: ~/dev/starting_sandbox/package.json
Command: run
Scripts: start
Node Interpreter: ~/.nvm/versions/node/v7.8.0/bin/node
Npm package: ~/.nvm/versions/node/v7.8.0/lib/node_modules/yarn

      

When this is done, I get an error:

/Users/byronsm/.nvm/versions/node/v7.8.0/bin/node /Users/byronsm/.nvm/versions/node/v7.8.0/lib/node_modules/yarn/bin/yarn.js run start
yarn run v0.21.3
$ react-scripts start 

~/dev/starting_sandbox/node_modules/cross-spawn/index.js:34
            throw new Error(
                  ^
Error: In order to use spawnSync on node 0.10 or older, you must install spawn-sync:

  npm install spawn-sync --save
    at Function.spawnSync [as sync] (~/dev/starting_sandbox/node_modules/cross-spawn/index.js:34:19)
    at Object.<anonymous> (~/dev/starting_sandbox/node_modules/react-scripts/bin/react-scripts.js:22:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:929:3
error Command failed with exit code 8.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

      

I was able to solve this issue in webpack when running scripts via npm using the option --scripts-prepend-node-path

. However, it doesn't look like yarn.

The problem with the node instance seems to be that the yarn is triggered when scripts are executed, instead of pulling from the same node binary that is used to execute the yarn itself, it uses what it finds in the $ PATH, which does not change ...

Is there a similar command you can use for yarn?

+3
node.js npm webstorm yarnpkg


source to share


No one has answered this question yet

Check out similar questions:

177
Run script no error when running npm start
109
NPM modules won't install globally without sudo
72
node.js, Error: Cannot find module 'express'
8
WebStorm - Error: Specify npm package
2
Running cucumber.js in WebStorm
1
Can't launch React app using WebStorm
1
can't install node-sass for Ionic
0
Failed to create react app using "create-react-app-demo" demo on ubuntu 14.04
0
Vue app with WebStorm on mac npm ERR! missing script: dev
0
TypeError: validateSchema is not a function



All Articles
Loading...
X
Show
Funny
Dev
Pics