简体   繁体   中英

npm throws Unknown command: "set-script" when creating new Ruby on Rails project

I am trying to create new Ruby on Rails project with:

rails new project -v 7.0.4 --css=sass --javascript=esbuild --database=mysql

And I get:

...
Add build script
         run  npm set-script build "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets" from "."
Unknown command: "set-script"

Did you mean this?
    npm run-script # Run arbitrary package scripts
...

npm version:

% npm -v
9.1.2
% which npm
/Users/foo/.nvm/versions/node/v19.1.0/bin/npm

Interesting is that nvm help doesn't even show set-script in "All commands" list.

I am on Mac M2, not sure if relevant. I didn't find anything on google.

set-script has been deprecated as per documentation

The below should work

npm pkg set scripts.build="esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM