It looks like you’re trying to declare the package membership in a Scala script (run using the scala command) or in the REPL.
Only files defining just classes and objects which are compiled with scalac may be defined as belonging to a package.
When you run code in a script or a REPL session, behind the scenes it is actually compiled inside a method of an object, in which scope a package declaration wouldn’t be legal.